rsnext/examples/custom-server-hapi/next-wrapper.js

14 lines
424 B
JavaScript
Raw Normal View History

2017-01-16 20:27:07 +01:00
const pathWrapper = (app, pathName, opts) => ({ raw, query }, hapiReply) =>
app.renderToHTML(raw.req, raw.res, pathName, query, opts)
.then(hapiReply)
const defaultHandlerWrapper = app => {
const handler = app.getRequestHandler()
return ({ raw, url }, hapiReply) =>
handler(raw.req, raw.res, url)
.then(() => {
hapiReply.close(false)
})
}
2017-01-16 20:27:07 +01:00
module.exports = { pathWrapper, defaultHandlerWrapper }