Skip to content

Commit

Permalink
Update custom-server-fastify example to not use internal fn (#11040)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobaaaaa committed Mar 13, 2020
1 parent 18036d4 commit f75c37f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/custom-server-fastify/package.json
Expand Up @@ -7,10 +7,10 @@
"start": "cross-env NODE_ENV=production node ./server.js"
},
"dependencies": {
"cross-env": "^5.2.0",
"fastify": "2.1.0",
"cross-env": "^7.0.2",
"fastify": "^2.12.1",
"next": "latest",
"react": "^16.8.4",
"react-dom": "^16.8.4"
"react": "^16.13.0",
"react-dom": "^16.13.0"
}
}
3 changes: 2 additions & 1 deletion examples/custom-server-fastify/server.js
Expand Up @@ -6,6 +6,7 @@ const dev = process.env.NODE_ENV !== 'production'

fastify.register((fastify, opts, next) => {
const app = Next({ dev })
const handle = app.getRequestHandler()
app
.prepare()
.then(() => {
Expand All @@ -30,7 +31,7 @@ fastify.register((fastify, opts, next) => {
})

fastify.all('/*', (req, reply) => {
return app.handleRequest(req.req, reply.res).then(() => {
return handle(req.req, reply.res).then(() => {
reply.sent = true
})
})
Expand Down

0 comments on commit f75c37f

Please sign in to comment.