Lessons I Learned from my First Five Node.js Projects

I recently completed my most recent freeCodeCamp certification for APIs and Microservices that focused on building small backend projects using Node.js, Express, MongoDB, and Mongoose. This post is a quick summary of the important things I learned while building my five projects.

In order to claim the certification, I built the following projects: a timestamp converter, a header parser, a URL shortener, an exercise tracker, and a file metadata microservice.

You can also find the code for each of these projects on my Github profile if you would like to see how I built each project in detail.

Timestamp API

Most of these projects seem very simple and they are for the most part. However, each one taught me very applicable stuff that I will be able to use in larger, future projects.

In this timestamp API, I learned how to pull values out of the URL with the request item returned by Express in the GET operation at a target URL.

While some of the RESTful HTTP functions were a little new to me, it was nice to also feel comfortable parsing the input strings and working with the date values because Node.js uses the same JavaScript that I have learned over the past years.

Header Parser

This project was also very simple, but actually taught me about new information on the Web that I should have noticed before. My API acted as a simple whois lookup and returned the header information as a JSON object.

I learned again how to use the GET operation to listen at a given URL to then send a JSON object in the response object using Express. At the very least, this project now gives me a quick way to look up my IP address on any computer using a project that I built.

URL Shortener

While this one probably didn’t end up as useful as I thought it was going to be, it did give me more experience with MongoDB and using Mongoose to access that database.

I discovered mLab for simple MongoDB hosting which made this project and the next ones much easier and I look forward to using mLab in the future on other personal projects.

In this project, I took a simple URL from an HTML form and then used the POST operation to send that URL to the MongoDB and also store the count that would then be used as the “short url.” From the same API I could navigate to a URL path with any given count and it would redirect to the URL that was previously submitted.

Exercise Tracker

This was by far the most involved API I built and could honestly be something I come back to in order to add a more advanced frontend. The API allows the user to create users and exercises for those users using HTML forms. A list of exercises which can be limited with different parameters can also be generated through a specified URL path.

I learned more about options in pulling data from the MongoDB database using Mongoose. I could search for all the exercises for a given user and then only return exercises from a given time frame with simple URL query parameters.

File Metadata Microservice

The last project I built was another one of the simpler ones, but is again something that I think I could use fairly frequently. Building applications that are this simple yet this useful with Node.js is what really makes me excited to learn and us the framework more in the future.

This application handles a file upload with the npm package Multer. Multer allowed me to quickly access file properties of the file uploaded and then I was able to convert the file size from Bytes to a more recognizable format using megabytes, gigabytes, etc.

Multer also pulls even more metadata from the uploaded files and appears to accept most file types so I could see myself adding a few more features to this project in the future for when I need to look into information about files quickly that isn’t easily available on MacOS or Android.

All in all, these projects were much smaller and simpler than the projects I built while learning React. However, I think the ideas and possibilities the knowledge I gained while building these makes me a little more excited to start using Node.js more in the future.

Combining the power of Node.js and Express with the ease of setting up quick projects on Glitch, I can really see myself building quick, useful applications in the future in between major projects. Ah, the joys of web application development!

While this post doesn’t dive as deep into my projects as my similar post after my React projects, I hope you enjoyed reading and learned something about the abilities of Node.js. If you are also currently learning Node.js or are interested in learning, I would love to have you follow along with my web development learning adventure on Twitter.

Thank you for reading and I hope to update you with new things I’ve learned or built soon!