Express.js Fundamentals: Routing, Middleware and APIs

Build web servers and REST APIs with Express routing, middleware, validation, authentication and testing. For Node.js developers.

Start course →

What you'll learn

  • Create routes with parameters, query strings and JSON bodies.
  • Explain middleware and write built-in and custom middleware.
  • Organize routes with Router and handle sync and async errors.
  • Connect a database, add JWT auth, CORS and security middleware.
  • Test with supertest, log requests and deploy to production.

Syllabus

Module 1: Getting Started

  1. What is Express?
  2. Installing Express
  3. Your First Server

Module 2: Routing

  1. Basic Routes
  2. Route Parameters
  3. Query Strings

Module 3: Middleware

  1. What is Middleware?
  2. Built-in Middleware
  3. Writing Custom Middleware

Module 4: Request & Response

  1. The req Object
  2. The res Object

Module 5: Handling JSON Bodies

  1. Parsing & Sending JSON
  2. Basic Input Validation

Module 6: Organizing Routes

  1. express.Router()

Module 7: Error Handling

  1. Error-Handling Middleware
  2. Async Error Handling

Module 8: Serving Static Files

  1. express.static()

Module 9: Connecting to a Database

  1. Express + a Database

Module 10: Authentication Basics

  1. JWT-based Auth

Module 11: CORS

  1. Enabling CORS
  2. Security: Helmet & Rate Limiting

Module 12: Configuration

  1. Environment Variables
  2. Request Logging with morgan & pino

Module 13: Testing & Deployment

  1. Testing Routes
  2. Deploying an Express App