未验证 提交 f75c37fc 编写于 作者: P Patrick Dahms 提交者: GitHub

Update custom-server-fastify example to not use internal fn (#11040)

上级 18036d4e
......@@ -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"
}
}
......@@ -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(() => {
......@@ -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
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册