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

sospedra picture sospedra  路  3Comments

irrigator picture irrigator  路  3Comments

wagerfield picture wagerfield  路  3Comments

timneutkens picture timneutkens  路  3Comments

flybayer picture flybayer  路  3Comments