For quite a while, I’ve been trying my hand out at developing web applications that are capable of having some form of persistent data. This is somethign that I’ve wanted to be able to do for quite a while, but it’s proven to be quite challenging, mainly due to the range of different tools available for this purpose, and also due the complexity of the different tools and the way they all work together.
In this first instance, I’ve developed a To Do List, using Node.js as my framework. Essentially, this is a more fully featured JavaScript package. I also made use of Node Package Manager (NPM), which does a lot of the heavy lifting when dealing with dependencies and packages. I also made use of Mongoose and Express (Mongoose means that I can work with MongoDB databases) and Express sets up Node.js as a Webserver. For appearance sake, I use the Pug (formerly Jade) the plating engine, which took some getting used to. I did all the coding inside visual studio and then released it via Heroku.
The final version allows users to create, read, update and delete ToDos and Categories. The ToDos have to be assigned a category, and they can also be assigned a status. In the future, I would like to make the status more of a segmented switch, but I couldn’t work out how to do that in such a fashion as to allow it to communicate with the code and the database (stored on MongoDB’s free tier).
The code base is stored on GitHub here, and the live demo is here (behind a password in my repo site).
The hardest part of getting this to work was actually the Heroku deployment. There were a couple of issues that I needed to address- the first was related to the pruning of dev dependencies, which I changes to this (see here) due to Browser-Sync not working nicely, and then the second issue was related to a conflict over the port between the app.js file (see here).