2 ms·
If anything I find that a router makes your code easier to test. If you're 100% consistent about using the router to obtain user input, then your code is easy
by jakejake 14y ago
If anything I find that a router makes your code easier to test. If you're 100% consistent about using the router to obtain user input, then your code is easy to unit test with a mock router. Routers themselves can be easy to test as well.
It's a clean separation of concerns - the router is the only thing that knows about the URL implementation. The rest of the code relies on the router to do that. That's a good practice to me.
What would you would consider "best practice" in place of a router?