How To Use Express Middleware

Middleware is a technique that allows software developers to make specific code run anytime an Express route is called. The middleware pattern makes it possible to execute code between a server receiving a request and sending a response. Hence the name Middleware, as it lives in the middle. Express uses middleware to apply behavior to request and response objects. Express middleware can do things like attach information to a response, inspect a request, pass a request and response to a different middleware, or perform some other logic.…

What Is express.Router() For

Express Routers are a way to organize your Express application such that your primary app.js file does not become bloated and difficult to reason about. As you’re building an Express application or API, you’ll soon notice that the routes continue to pile up in app.js. This makes the file quite long and hard to read. As we add functionality to an application, this file would get long and cumbersome.…

How To Setup Express Routes

How To Setup Express Routes

JavaScript is the language of the web and you are likely familiar with it running in all of your favorite web browsers. JavaScript also runs on the server via Node and in this tutorial, we’ll take a look at setting up routes in the popular Express framework. To start using Express, first, make sure Node is installed on your machine. You can check with the command node -v.…

Higher Order Functions In JavaScript

javascript higher-order functions

Without fail, you are going to need to iterate or loop over data in your programs no matter the language. In JavaScript, we have several loop constructs to do this, as well as the so-called higher-order functions. These higher-order functions allow a more concise syntax to allow you to iterate over a collection while applying the logic of your choice to each item in the collection if you like.…

React useState Hook

react use state hook

There has been a paradigm shift in how React works with regard to state, classes, and functions. React now has a feature called hooks, and it looks like a game changer. From reading the react documentation, and watching React Conf, it looks like us web developers should become familiar with Hooks in React since they make for cleaner React code. Class components are still supported, but it looks like Hooks in combination with Function Components are the favored approach moving forward.…

Create A Navbar Component In React

react lift state navbar

In this tutorial we are going to add a NavBar component to the application we have been building in React. During this process we’ll need to do some refactoring in order to shift local state out of child components, and into the App parent component. By following this convention, we’ll need to raise events in the child components while handling them in the parent component. This allows our application to have a single source of truth.…

How To Delete An Item From An Array In React

How To Delete An Item From An Array In React

In this react tutorial we’ll review a few things and then look at how to delete an item from an array. The number of items in the array determines how many item components are displayed on the page. We want to be able to click a button on a specific item, and have React automatically remove it from the page. But first, let’s review a few key concepts in React.…