Let's add a persistent layer to our data. Currently, our data is a simple JSON object. But later we will see examples of updating and deleting through our API endpoints. It's better to use a database to persist data across server restarts. Else while nodemon restart the server, the data you added/updated will get changed back.
We will use a simple lightweight file-based database called
The course concentrates on REST API design. So we have chosen a simple database. You can use the database of your choice to achieve the same results.
diskdb syntax is like the old MongoDB nodeJS driver. So you can always replace it will real MongoDB without changing much of the code.
npm i -S diskdb