Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js Home Route

Roman Smolkin
Roman Smolkin
969 Points

Benefit of routes

What is the benefit of using routes? And what's the difference between using routes in Node.js vs like AngularJS? Is there a limit to how many routes you can have? If you add a lot of routes, does performance get slow cause it has to go through hundreds of routes?

1 Answer

Routes are essential for single page applications. If you want to create a SPA you can do the routes manually using the HTML5 history.api and javaScript but it is easy to end up in a mess (depending on the project). Using routes libraries like the one I know 'react-router'/'react-router-dom' saves you lots of time and is much more stable. I think performance is not an issue here.