nodejs – use mongodb for CRUD application

In this article I’m going to create a minimalistic CRUD application with nodejs, express and mongodb. First I will show you the pug files and finally the nodejs code for creating our application.

To use mongodb you have to install it on your (ubuntu) box with:

Then we have to add the node module to our project (and package.json) with:

Now on to the pug files. First of all the ‘index.pug’ file (remember pug files are stored in the views folder (default).

Then we have the ‘all.pug’ file which gives us an overview of entries in the database together with a link to delete or edit the entry

We have an ‘edit.pug’ file to edit our document entries

And finally we have our app.js nodejs application.


Leave a Reply

Your email address will not be published. Required fields are marked *