hands-on lab

Integrating Middlewares in ExpressJS Applications

Intermediate
45m
131
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.
Lab 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:

About the author
Students
40,024
Labs
106
Courses
2
Learning paths
10

Stefano studies Computer Science and is passionate about technology. He loves working with Cloud services and learning all the best practices for them. Google Cloud Platform and Amazon Web Services are the cloud providers he prefers. He is a Google Cloud Certified Associate Cloud Engineer. Node.js is the programming language he always uses to code. When he's not involved in studying or working, Stefano loves riding his motorbike and exploring new places.

Covered topics
Lab steps
Understanding the ExpressJS Middlewares Principles
Connecting to the NodeJS Web IDE
Writing and Integrating Middlewares in ExpressJS