Previously I wrote an introductory article on how to deploy a NodeJS application in a Kubernetes cluster. It was a step by step guide on carrying out the said task in a local setup. It introduced concepts like Deployments, Services, ConfigMaps which are fundamentals of Kubernetes.
In Kubernetes even with a small application, there are quite a number of files and commands we need to use in order to get a deployment done. …
This blog will walk you through the steps of how to deploy a NodeJS application in MiniKube. We will be using a local docker image without relying on a Docker registry.
At this stage, I’m assuming you have a general idea of what Kubernetes is. If not https://kubernetes.io/ is a great place to start.
Before starting the tutorial, make sure you have the following installed on your machine (Assuming Docker and Node are pre-installed)
— Minikube is a tool to learn and develop Kubernetes locally
— Kubectl is a command-line tool that allows you to control…
Monolithics — In modern software development, this is something we try to avoid because they have proven to be hard to maintain, refactor, debug, … etc. Instead, the software industry had adopted, Microservice pattern for designing backends.
Even with a well-designed backend, it is common that the frontend of an application may suffer from Monolithic architecture. Frontends are ever-changing and many teams are working in the same codebase, resulting in a complex and hard to maintain frontend app.
To avoid this, the concept of Micro Frontends has been introduced. The article by ThoughtWorks is a very detailed explanation of this…
You might be wondering why do we need the HttpSession in the WebSocket connection?
For me, I was developing a test chat application and I stored the logged-in user information by the HttpSessionId. It is not the ideal setup but served the purpose. I wanted to have the user information when they chat using the WebSocket protocol. So I needed the current HttpSession in the WebSocket connection.
I found solutions from StackOverflow but wanted to try a different mechanism. So there it goes.
It important to understand that,
HTTP and WebSocket protocols are based on TCP protocol.
And, as given…
Force = Mass x Acceleration; is a fundamental equation in mechanics that cannot be proven to be correct. Rather, it’s correctness is derived by not being able to prove the falseness. It’s the nature of scientific theories and laws that they are falsifiable but not provable.
This is the same for the software we write, they cannot be proven to be correct (or hard ) and only can be proven to be incorrect. Tests are a way of proving the software is incorrect. Dijkstra has stated,
Testing shows the presence of bugs, not the absence.
Thus if tests show the…
Multer and Cls-hooked are two important modules in the NodeJS ecosystem. Multer,
Multer is a node.js middleware for handling
multipart/form-data, which is primarily used for uploading files.
Continuation-local storage works like thread-local storage in threaded programming, but is based on chains of Node-style callbacks instead of threads.
Let’s consider a general use case of these modules in an Express application.
The following web app, exposes
POST /upload endpoint to upload a file. We use Multer middleware to read the file named
userfile in the request. …