Creating a locally developed containerized service is quite slow. To test every code change, the developer would have to make the code change then destroy the existing container, rebuild the container and restart it. Volumes makes that process efficient.

When a container is destroyed, any state is lost with it. Docker offers volumes which could be mounted to a container allowing data to be persisted outside of a container’s standard lifecycle. This is used for running databases and containers that allows avoiding rebuilding containers with every code change.

To run volumes, add “-v” to the regular docker run command. Map…

Before trying to understand Docker Containers, it’s good to have a basic grasp of how the operating system on your local machine normally works.

Most operating systems have what’s called “a kernel”. A kernel is the core of an operating system. It manages and maintains the operations of the programmes that are running on the computer and the physical hardware — memory, CPU time and Hard Disk. When I say “programmes”, I mean the likes of Chrome, Spotify or the text editor you use to build your code. …

The key aspect of Docker is that it makes it easy to install and run software without worrying about dependencies.

Docker is a platform or ecosystem around creating and running containers. Within Docker’s ecosystem are various projects, tools and pieces of software that are sometimes used singularly or altogether. There are Docker Client, Docker Server, Docker Hub, Docker Machines, Docker Images and Docker Compose.

When you run a command in terminal, the Docker Client (Docker CLI) connects with the Docker Hub and downloads a Docker Image. A Docker Image is a single file containing all the dependencies and all the…

Previously, I’ve been hesitant to veer away from building on my core coding abilities. I’d assumed that to begin to get a basic understanding of the cloud infrastructure, I’d need to be a competent/expert programmer or I thought that I’d wait and get introduced to the various aspects when I start working. However, that doesn’t have to be the case. In fact, you don’t need to be an Engineer to understand and use Docker, Kubernetes, AWS or anything else required to deploy and host an app.

So, I’ve started, quite gently, learning Docker.

What is Docker?

Docker is a virtualisation…

To get a specific post, you’ll use the Post model and an inbuilt method, “findById”. As it could take some time because it’s pulling from a database, add “async” and “await”.

router.get('/:postId', async (req, res) => {
try{
const post = await Post.findById(req.params.postId);
res.json(post);
} catch(err) {
res.json({ message: err });
}
})

To delete a specific post, you’ll need to use the Post model again. Add “_id” because this is the parameter MongoDB generates per object.

router.delete('/:postId', async(req, res) => {
try {
const removedPost = await Post.remove({ _id: req.params.postId})
res.json(removedPost);
} catch (err) {
res.json({ …

To create a post, firstly, import the model that will be receiving the post. At the top of ‘posts.js’, import the model by typing in the following:

const Post = require('../models/Post');

Within the body of ‘posts.js’, type in

router.post('/', (req, res) => {
});

To handle a ‘HTTP POST’ request in, you’ll need to install a middleware module called ‘body-parser’. This will extract the entire body of an incoming request and deliver it on ‘req.body’. It parses the JSON, buffer, string and URL encoded data submitted using ‘HTTP POST’ request. To install this, run

npm install body-parser

In ‘app.js’, you’ll…

A key aspect of programming is to always ensure your code is readable and also structured in a way that ensures that there’s flow. The “app.js” file can get cluttered quite quickly with lots of code so when you can, to avoid constantly scrolling to reach the line of code you need to amend, split your code into separate files and folders. I’ve created a folder called “routes” and within that folder, a file called “posts.js”.

At the top of the “posts.js” file, add:

const express = require('express');const router = express.Router();

What’s achievable with this file splitting structure is…

In Part 1, we imported the Express package, executed it, and created a route to the home page.

With routes, we can add the logic to retrieve, update, or delete any information or data we want. In Part 1, I built a route to the homepage that displayed the message, “Homepage”. Using the same logic, I could add another GET route:

app.get('/friends', (req, res) => {
res.send("Friend page");
});

and when I go to http://localhost:3000/friends, I’ll get the below:

So, with routes, when the user visits the homepage or friends page, they’re sending a request and the server is responding…

Recently, I was invited to interview for a role. Part of the recruitment process involved a tech assessment that required using Node.js but particularly, Express.js, the framework for Node.js. I’d never used Node.js let alone Express.js so I embarked on an intense learning schedule to prepare for the assessment. Over the next series of articles, I’ll show what I learned by detailing how to build a basic RESTful API using Express.js and MongoDB.

After creating a project folder in the code editor (I use VScode), you’ll need to install Express and Nodemon. Nodemon is a tool that automatically updates and…

When adding the “sorting” functionality to an already created table in an app, the first thing to avoid is “mixing levels of abstraction”. You should avoid mixing the high level and low level components as this reduces symmetry in your code. In my already created app, I’ve extracted the table which will have the sorting functionality from the main component and created a new file and inputted the table in the newly created file. I’ve created a functional component called “Table” and passed in props. I don’t need state and as it’s functional, render isn’t required. The table also has…

Chuk Orakwusi

Junior Front-end Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store