Synchronous Programming → Blocking . Each statement in your code will executed one after the other. Each statement must wait until the previous statement has completed executing.
Asynchronous Programming → Non-Blocking (does not mean concurrent or multi-threaded). The programs we are building are single-threaded. Any program that is working with network access is dealing with async code.
Starting a new application, cd into your desired path location and make a new folder: mkdir <app_name> . Change directory into this app type in terminal command: npm init — — yes to set up your package.json file. Next, make a new file…
Express is a bunch of middleware functions. Middleware functions are called sequentially. Every route handler function ( (req, res) => {res.send(‘Hello World’)} ) is technically a middleware function.
Built-In Middleware²
express.json() — middleware: parses body of the request, if there’s a json object it populates req.body property
express.urlencoded() — middleware: parses incoming requests with url encoded payloads parses req.body like a json object
express.static(‘public’) — all of the static assests of the app will live in a ‘public folder’ (((create that folder in the main folder)))
Custom Middleware
Custom middleware functions should be built…
Express is a Node.js web application framework². It is fast and lightweight way to build a RESTful backend service. We will use it to build a web server on top of Node.
In your terminal, navigate to your application path, in the terminal type command³: npm i express .
In your application, create a new file: index.js . Load the Express module as follows:
As you can see, the express() function returns the Express object, that we have now named ‘app’. …
As a disclaimer, this series of blogs I’ll be taking notes as I work through Mosh Hamedani’s ‘The Complete Node.js Course’. I am by no means taking credit for any of the following, simply using these blogs as a quick reference to myself as I learn Node.
Node is a runtime environment for executing Javascript code outside of the browser. It is NOT a programming language or a framework. It is a C++ program that includes Chrome’s V8 Javascript engine.
Node has a non-blocking/asynchronous nature. Node.js applications run on a single thread along with its event loop. Node is good…
Ruby On Rails Steps:
User Authentication with JWT — JSON Web Tokens
Last week, in Part 1, I covered the first half of this series with building frontend and backend User Sign Up functionality. This article will cover the second half: User Sign In ,User Auto-Login & User Sign Out.
In regards to the backend, I am going to follow the same steps as last weeks article and past my three backend controllers quickly here so that we can focus on the frontend components and attribute the code much to Reinald Reynoso’s great blog that started me down this path.
JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.¹ The content inside the JWT (pronounced ‘jot’ if you can believe it!) can be trusted and verified because it’s digitally signed (JWS, RFC 7515). The signature in our use case will be generated by using symmetric keys (HMAC algorithms). Default JWT (which is what the below example will show) are NOT encrypted, but JWT can carry encrypted data (JWE, RFC 7516) to protect sensitive information. …
Redux is a state container for Javascript applications. Redux keeps our application’s states in one, centralized location which is not only cleaner, more organized, and easier to understand, but it makes debugging our state problems waaaay easier and it makes it quicker and easier to scale our apps, when needed. Without Redux, we have the nasty task of passing state to our child and grandchild components from parent components as props and having to follow the trail through each component when we need to pass the props (for example in call-back functions) back up to our parents. …
How many movies have you really watched in the past year? Imagine just how many people have gotten through this pandemic with the help of a multitude of streaming services available. While we all binge on movie after movie, show after show, our networks have been congested with this massively heavy load of data. This congestion leads to connection errors and slow load time, or what an article, written by Bell Labs back in 2000, refers to as ‘client latency start-up’².
“Caching (pronounced “cashing”) is the process of storing frequently used data in memory, file system or database which saves…
Stacks and queues are extremely common data structures. Now, there are differing views as to whether stacks and queues are actually data structures or if they are ‘more of a pattern that is implementable…with other data structures.’¹ This article will stick with the school that views them as data structures, even though I fully understand the train of thought that when we use stacks and queues while working with other structures, they become more of a pattern of usage.
Stacks and queues are both linear data structures and are collections, or storage units, for data. Linear data structure[s] have data…
Software Engineer. A new addict of ReactJS & Javascript, CSS & APIs, with a little dabbling in Ruby, Ruby On Rails…