Skip to content

Commit a76f975

Browse files
IvanJovtimneutkens
authored andcommitted
Custom hapi server example handle static files (#6822)
While implementing hapi as a custom server, I found a minor issue. The example provided isn't showing that we also need to serve static files using next. This change should fix that. Thanks!
1 parent c4220d2 commit a76f975

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/custom-server-hapi/server.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ app.prepare().then(async () => {
3232
handler: nextHandlerWrapper(app)
3333
})
3434

35+
server.route({
36+
method: 'GET',
37+
path: '/static/{p*}' /* use next to handle static files */,
38+
handler: nextHandlerWrapper(app)
39+
})
40+
3541
server.route({
3642
method: 'GET',
3743
path: '/{p*}' /* catch all route */,

0 commit comments

Comments
 (0)