Commit 993cab89 authored by Jepser Bernardino's avatar Jepser Bernardino Committed by Tim Neutkens

Update Hapi example (#6429)

Since version 18 (released in January), Hapi's `request.url` returns the parsed URL, so `parse` is not needed.

Ref:
- https://hapijs.com/api#-requesturl
- https://github.com/hapijs/hapi/pull/3822
parent f7ee137f
const { parse } = require('url')
const nextHandlerWrapper = app => { const nextHandlerWrapper = app => {
const handler = app.getRequestHandler() const handler = app.getRequestHandler()
return async ({ raw, url }, h) => { return async ({ raw, url }, h) => {
...@@ -8,7 +6,7 @@ const nextHandlerWrapper = app => { ...@@ -8,7 +6,7 @@ const nextHandlerWrapper = app => {
} }
} }
const defaultHandlerWrapper = app => async ({ raw: { req, res }, url }) => { const defaultHandlerWrapper = app => async ({ raw: { req, res }, url }) => {
const { pathname, query } = parse(url, true) const { pathname, query } = url
return app.renderToHTML(req, res, pathname, query) return app.renderToHTML(req, res, pathname, query)
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"start": "NODE_ENV=production node server.js" "start": "NODE_ENV=production node server.js"
}, },
"dependencies": { "dependencies": {
"hapi": "^17.1.1", "hapi": "^18.1.0",
"next": "latest", "next": "latest",
"react": "^16.7.0", "react": "^16.7.0",
"react-dom": "^16.7.0" "react-dom": "^16.7.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment