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

ACT
67.8K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Persistence

Here is an example of using a database. To do so, the todo model has been extracted from app.js and added as a module in the models folder:

 /
  |
  | - app.js
  | - models/todo.js

Within the todo.js module, a require has been done to the sqlite3 module that enable the use of an in-memory database.

Example of use of persistence

Now we have to work on the presentation layer.

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content