3 ms·
The whole notion of putting all of the routes in a single file strikes me as questionable. I think Express has it right, define the route along with the code th
by erikpukinskis 10y ago
The whole notion of putting all of the routes in a single file strikes me as questionable. I think Express has it right, define the route along with the code that's going to run on it. If you want to see all of your routes together, just have some kind of dumpRoutes() call that you can make.
And I don't believe we're saving ourselves any real complexity by creating standardized API for prefixes and such. The cost of having to type /posts/new and /posts/favorite seems like a small price to pay for a dramatic improvement in clarity and decrease in router complexity.
Some programmers take DRY way too far.
- maxdeviant 10y agoReact Router v4 places a greater emphasis on splitting up your routes, as opposed to keeping them all in one spot [1]. It also allows you to do really cool stuff like in their recursive routing example [2]. [1]: https://react-router.now.sh/basic https://react-router.now.sh/basic [2]: https://react-router.now.sh/recursive-paths https://react-router.now.sh/recursive-paths