Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.