Files
buuh/examples/server-rendering/client.js
T

24 lines
411 B
JavaScript
Raw Normal View History

2016-12-11 19:35:29 +01:00
const mount = require('../../mount')
2016-05-21 21:59:03 +09:00
const choo = require('../../')
2016-12-11 19:35:29 +01:00
const mainView = require('./view')
2016-05-21 21:59:03 +09:00
const app = choo()
2016-05-23 23:39:22 +09:00
app.model({
namespace: 'message',
state: {
server: 'rehydration has kicked in, server data was tossed',
client: 'hello client!'
}
})
2016-12-11 19:35:29 +01:00
app.router(['/', mainView])
2016-05-21 21:59:03 +09:00
if (module.parent) {
module.exports = app
} else {
2016-12-11 19:35:29 +01:00
const tree = app.start()
mount('#app-root', tree)
2016-05-21 21:59:03 +09:00
}