Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've worked with both. There are days when I prefer a programmatic approach, and days I love the file-based router. With the introduction of routing middleware [0], Next.js finally offers anything I'd want to build.

An option would be to add a catch-all route [1] at the root and implement your own code-based routing. You can still define the desired paths using getStaticPaths [2] but my guess is that some functionality like route-based code splitting will stop working.

0 - https://nextjs.org/docs/advanced-features/middleware

1 - https://nextjs.org/docs/routing/dynamic-routes#catch-all-rou...

2 - https://nextjs.org/docs/basic-features/data-fetching/get-sta...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: