Back
Close

Building a Basic Todo List REST API in Node.js with Express

ACT
65.8K views

Parameters

Express allows to extract parameters from the url. A parameter is defined in an URL with the ":" prefix. It is aviailable as a member of request.params.

var myParam = request.params.myParam

Route parameters are named URL segments that are used to capture the values specified at their position in the URL. The captured values are populated in the req.params object, with the name of the route parameter specified in the path as their respective keys.

from http://expressjs.com/en/guide/routing.html

Exercise: Complete the PUT function

Last Action: DELETE

To conclude this part of the tutorial, please find bellow a basic implementation of the DELETE method.

DELETE Method

As you can see, all the code is in one file, we do not have a clear separation of each layer. Let's move on how the next page to add a database and also refactor and organize our code with modules.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io