Hello once again!
Yesterday, I wrote briefly about how I have started learning Node.js and Express. I mentioned I would be sticking with the tutorial on Mozilla Development Network for Node.js and Express. I also talked about other supporting materials such as Beginning Node.js and Learn NodeJS in One Day.
Today, I want to run through my progress so far and share a few things I have come to understand so far. The first thing I created after going through the theoretical parts of Node.js from the 'Learn Node.js in One Day' book was this simple server, all it did was print "Hello World" on the screen when you navigate to port 8000 while the code is running in the terminal. This made me smile.
I dove deeper into the MDN tutorials in the next few days, then I got introduced to the minimalist and unopinionated Node.js web framework called Express. One of the things I like about Express is the Express Generator, simply because of the ease to generate a project by using express name-of-app/project. On running this command, the following will be generated:
I will talk about these files in a later article.
The MDN tutorial's first project endeavour is to build a local library website, now, you would expect a website to have actual pages we can see stuff like 'books', right? Node.js does provide us with view options made possible by something called 'Template Engines'. These Template Engines help us to present data on the client-side. Ordinarily, the default template engine provided if you run express hello-world would be the engine called Pug (formerly Jade).
MDN does a good job of explaining consideration points before selecting a template, some of them include:
- Time to productivity
- Popularity and activity
See the write-up here
When building APIs, you will most likely want to save data somewhere, persist whatever is created or edited on the client, this is where the database comes in. Node.js works with various types of database, SQL or NoSQL and Express works with the databases Node.js supports as it does not have any specifics when it comes to Databases.
MDN describes how you can communicate with your preferred database in two ways.
- Using the database's native query language
- Using an Object Data Model or Object Relational Model
In this article, I talked about the Express Generator, View engines and Database. In the next set of articles, I will talk about the Local Library project and my progress in it so far. As always, the code for this journey lives here
Thank you for sticking with me to this point.