O'Reilly logo

Node.js, MongoDB, and AngularJS Web Development by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applying Parameters in Routes

As you begin implementing routes, you will quickly see that for complex systems, the number of routes can get out of hand. To reduce the number of routes, you can implement parameters within the URL. You can use parameters to use the same route for similar requests by providing unique values for different requests that define how your application handles requests and builds responses.

For example, you would not have a separate route for every user or product in your system. Instead, you would pass in a user ID or product ID as a parameter to one route, and the server code would use that ID to determine which user or product to use. There are four main methods for implementing parameters in a route:

Query strings: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required