Topics Covered

Duration: 80 minutes


Learning Objectives

  1. Understand and use middleware for enhanced functionality.

  2. Handle static files and perform input validation.

  3. Implement advanced middleware like authentication.


Topic Outline (30-min)

  1. Middleware Essentials:

    • Role and execution flow.

    • Built-in vs. custom middleware.

  2. Static File Serving:

    • Use middleware to serve static files.

  3. Input Validation:

    • Validate request payloads using libraries like express-validator.


Student Activity (30-min)

Activity: Implement Middleware for Validation

Homework/Practice Coding Assignment (20-min)

Task: Extend the API to:

  1. Serve static HTML files for /home and /contact.

  2. Add middleware to log request time and method for all routes.

Last updated