Skip to content

Commit

Permalink
Remove path specific switch statement from http2 example
Browse files Browse the repository at this point in the history
Is this switch necessary
  • Loading branch information
mohsen1 authored Aug 25, 2020
1 parent 2e12e86 commit 951f9c5
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions examples/with-http2/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,7 @@ const server = http2.createSecureServer({

app.prepare().then(() => {
server.on('error', (err) => console.error(err))

// Process the various routes based on `req`
// `/` -> Render index.js
// `/about` -> Render about.js
server.on('request', (req, res) => {
switch (req.url) {
case '/about':
return app.render(req, res, '/about', req.query)
default:
return app.render(req, res, '/', req.query)
}
})

server.on('request', (req, res) => app.render(req, res, req.url, req.query))
server.listen(port)

console.log(`Listening on HTTPS port ${port}`)
Expand Down

0 comments on commit 951f9c5

Please sign in to comment.