Home Dev Blog DevBlog#1: Node/Express API with Docker

DevBlog#1: Node/Express API with Docker

by wforbes

The Youtube algorithm blessed me with a fantastic tutorial video on setting up a Node.js API server using Docker about 3 months ago. It’s a major CHONK of a video, with a length clocking in at over 5 hours… but WELL worth the time if you’re at all interested in web development. Node.js, Express.js, MongoDB, Redis, and Docker are all key components of the modern web industry.

Subscribe to the original creator at https://www.youtube.com/channel/UC2sYgV-NV6S5_-pqLGChoNQ

At first, I spent a few hours on it and got the first couple sections done, but then my work and school schedule caught up with me and I needed to simultaneously finish my college term crunch time AND pick up an extra project at the office because our strongest developer was resigning. Yikes.

I was blessed with the last week of 2021 free from work on PTO, so I dug in and finished the tutorial.

The resulting code is kept in a repository on my Github at https://github.com/wforbes/node-docker

The resulting application is running on DigitalOcean at http://164.90.153.250/api/v1 (as of writing this blog post).

Using an API testing tool like Postman, you’ll be able to hit that 164.90.153.250 URL with a POST request to Signup, Login, Create a post, view all posts, and update a post.

hitting the /users/signup endpoint to create an account

It uses a cookie to keep track of your session, but overall it’s a really barebones project. It doesn’t exactly account for best practices when it comes to security in a couple spots, and I don’t think it’s a prime candidate for an application of the year award.

The entire goal behind the tutorial is to teach the introductory DevOps practices for working with Docker. How to build and run multiple containers, have them interact with each other, deploy them, update them, load balance it, and orchestrate multiple instances of them. It’s an amazing boilerplate to quickly start up and new project with, add on to, and learn a lot from.

As you can tell from the readme file at https://github.com/wforbes/node-docker I tried to keep detailed notes of everything from the video. That way I can (or you can) reference them later to see various commands and the order of progression in setting up the project.

Hope you find this tutorial as helpful as I did. I’ll be adding a Vue.js front-end client to it today, then building out some more interesting features on it.

Stay tuned to this site here for future articles. Thanks.

You may also like

1 comment

DevBlog#2: Adding Vue Docker Container – wforbes.net January 4, 2022 - 1:12 am

[…] my last DevBlog, I explained the Node/Express/Docker API project I started. Today, I’m adding a Vue front-end […]

Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.