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

timneutkens picture timneutkens  ·  3Comments

renatorib picture renatorib  ·  3Comments

swrdfish picture swrdfish  ·  3Comments

wagerfield picture wagerfield  ·  3Comments

rauchg picture rauchg  ·  3Comments