Open perguth opened 5 years ago
This a 🐛 bug report.
.documents is not accepting an object as second parameter even though it's documented in the README.
.documents
var someState = { render: 'me' } // Documented API: // `compiler.documents(routename, [opts], done(err, { buffer, hash }))` compiler.documents('/', { state: someState }, noop) // Render the document passing `state` to the render function.
uncaughtException { AssertionError [ERR_ASSERTION]: 'object' == 'function' at Bankai.documents (/application/node_modules/bankai/index.js:172:10) at Server.http.createServer (/application/server.js:107:17) at Server.emit (events.js:189:13) at parserOnIncoming (_http_server.js:676:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) generatedMessage: true, name: 'AssertionError [ERR_ASSERTION]', code: 'ERR_ASSERTION', actual: 'object', expected: 'function', operator: '==' }
Maybe build on https://github.com/choojs/bankai/pull/446?
I would like to just prerender the document instead of letting the client wait to receive it's initial state via WebSockets.
const server = http.createServer((request, response) => { if (request.url === '/') { compilerCli.documents('/', { state }, (error, node) => { response.setHeader('content-type', 'text/html') gzip(node.buffer, request, response) }) } compilerHtml(request, response, function () { response.statusCode = 404 response.end('not found') }) })
Maybe @yoshuawuyts ? 🎈
This a 🐛 bug report.
.documents
is not accepting an object as second parameter even though it's documented in the README.Expected Behavior
Current Behavior
Possible Solution
Maybe build on https://github.com/choojs/bankai/pull/446?
Context
I would like to just prerender the document instead of letting the client wait to receive it's initial state via WebSockets.
Code Sample
Your Environment