Next.js: How to define multiple routes on a custom server?

Created on 17 Dec 2016  路  3Comments  路  Source: vercel/next.js

Hi, I need to implement multiple parametized routes like:
/profile/:id , /profile/:id/edit , /item/:id , /item/:id/edit etc...

the 'parameterized-routing' example is using a custom server which uses 'path-match' npm package.
Both the 'parameterized-routing' example and the 'path-match' readme file demonstrate a single route example and I wasn't able to hack my way into implementing multiple routes...

Your help would be very much appreciated
Thank you
Ajar

Most helpful comment

For everyone visiting this issue: please note that the custom server API has not been released to npm yet :D

All 3 comments

@Ajar-Ajar you could simply use express for that. Use express's routing APIs.
See: https://github.com/zeit/next.js/blob/master/examples/custom-server-express/server.js#L11

For everyone visiting this issue: please note that the custom server API has not been released to npm yet :D

Thank you @arunoda !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olifante picture olifante  路  3Comments

jesselee34 picture jesselee34  路  3Comments

havefive picture havefive  路  3Comments

pie6k picture pie6k  路  3Comments

timneutkens picture timneutkens  路  3Comments