The first part we already know, /todos/, but now what we need is a URL parameter. URL parameters follow this pattern: it's a colon followed by a name. Now I could call this :todoId, or anything else, but what we're going to call it for this section is :id. This is going to create an id variable; it's going to be on the request object, the one we'll set up in just a moment, and we'll be able to access that variable. That means when someone makes the GET /todos/1234324 request, the callback will fire, the one we're going to specify now, and we'll be able to query by the ID they pass in. Now, we are still going to get the request and response object, the only difference is we're now going to be using something off of ...
Taking on the challenge
Get Advanced Node.js Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.