Same url routes for completely different pages?
Unanswered
Singapura posted this in #help-forum
SingapuraOP
Let's say you have a site.com/fruit/banana and also site.com/vegetable/onion
/fruit and /vegetable each have their own page that are completely different, and so do the items /banana and /onion
The data is received from an external API backend. What's the expected way of handling this in Next?
Is it having a single site.com/[page]/[slug] route and checking by type from the API? Having multiple routes?
What if in the future it's necessary to have eg. site.com/fruit/apple/red-apple/sapling with each of those having its own page?
Just interested in some pointers in the right direction
/fruit and /vegetable each have their own page that are completely different, and so do the items /banana and /onion
The data is received from an external API backend. What's the expected way of handling this in Next?
Is it having a single site.com/[page]/[slug] route and checking by type from the API? Having multiple routes?
What if in the future it's necessary to have eg. site.com/fruit/apple/red-apple/sapling with each of those having its own page?
Just interested in some pointers in the right direction
1 Reply
Hi!
You can take a look at the catch-all route doc: https://nextjs.org/docs/canary/app/building-your-application/routing/dynamic-routes#catch-all-segments
You can take a look at the catch-all route doc: https://nextjs.org/docs/canary/app/building-your-application/routing/dynamic-routes#catch-all-segments