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

Role based access control is one of the simplest examples, your routes need to be conditional and all come with related metadata for permissions and such. With file-based routing you'll then end up with your routes defined in one place and the configuration for them either in a separate different place or split up across the codebase. Whenever you need to change something you need to remember to do it everywhere else. If your routing is in code, you can define everything in one place with strict type checks, tests, and so on.


File-based routing makes sense for some systems, particularly CMS, where the content is files and that drives the navigation. But this is a more website thing, not an app thing, and many things want to be apps, not websites.




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

Search: