hands-on lab

Integrating Middlewares in ExpressJS Applications

Difficulty: Intermediate
Duration: Up to 45 minutes
Students: 134
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

When building a complex application, you sometimes need to integrate middle parts between two logic flows. As an example, one of the most known middle parts is the authentication and then the authorization parts. When you trigger an endpoint, before reaching the logic associated, you want to authenticate the request. These middle parts are called middlewares. Because of their importance, the ExpressJS framework provides an easy way to define middlewares. You can both define local middlewares, so they will be associated to a single part (such as a single route); but you can also define global middlewares, so they will be associated to multiple parts.

In this lab, you will understand the basic concepts of middlewares, you will try to use pre-defined middlewares, and you will then create two custom middlewares that you will implement.

Learning Objectives

Upon completion of this beginner level lab, you will be able to:

  • Understand the principles of middlewares in ExpressJS
  • Create and integrate ExpressJS middlewares

Intended Audience

  • Software engineers that want to deep dive into the ExpressJS middlewares system
  • JavaScript developers that need to define middlewares for their ExpressJS applications

Prerequisites

To get the most out of this lab, you should have basic knowledge of the ExpressJS framework. To achieve this, we suggest taking the following lab and courses:

Covered topics

Lab steps

Understanding the ExpressJS Middlewares Principles
Connecting to the NodeJS Web IDE
Writing and Integrating Middlewares in ExpressJS