Javascript Closures Explained (With Examples)

One of the most important, but often misunderstood concepts in javascript is closures. Understanding closures unlocks programming patterns that would be difficult to use otherwise. In this post, we will understand what closures are, and go through a few examples to solidify our understanding of them. The Lifecycle Of A Function First, let’s take a look at a simple function: function getValue(){ var a = 1 var b = 2 return a + b } var val = getValue() console....

 · Soham Kamani

Implementing OAuth 2.0 with Node.js

OAuth2 is an authentication protocol that is used to authenticate and authorize users in an application by using another service provider. This post will go through how to build a Node.js application to implement the OAuth2 protocol. If you just want to see the code, you can view it here How OAuth2 Works Let’s take a brief look at the OAuth protocol before we jump into implementation. If you’ve ever seen a dialog like this, then you’ve probably used OAuth before:...

Last Updated:   · Soham Kamani

How express.js works - Understanding the internals of the express library ⚙️

If you’ve worked on web application development in node, it’s likely you’ve heard of express.js. Express is one of the most popular lightweight web application frameworks for node. In this post, we will go through the source code of express, and try to understand how it works under the hood. Studying how a popular open source library works, will help us make better applications using it, and reduces some of the “magic” involved when using it....

 · Soham Kamani

Adding a Redis Cache To Your Node.js Server

NodeJs is known for its speed with respect to async tasks, but there’s still a lot of potential to make responses from your server even faster, sometimes by orders of magnitude. In this post, we are going to go through a brief introduction to the concept of caching, along with a tutorial on how to implement it using redis and an express server. What Is Caching? Normally, when you make a web server with a database, each request to the server entails one or more requests to the database, and some processing of the results before sending back a response....

 · Soham Kamani