Module 1: Fundamentals of REST - Understanding the Core Principles

Module 2: API Design Best Practices - Crafting Elegant and Usable APIs

Module 3: Building REST APIs (Node.js + Express) - Bringing Your Design to Life

// controllers/userController.js

const userService = require('../services/userService');

exports.getAllUsers = async (req, res) => {
  try {
    const users = await userService.getAllUsers();
    res.json(users);
  } catch (error) {
    res.status(500).json({ message: error.message });
  }
};

// ... other controller methods

- **Hands-on Assignments:**
    - Set up a basic Express.js project.
    - Create routes for different resources.
    - Implement middleware for logging requests and validating data.
    - Build a modular architecture with controllers, services, and models.
    - Connect your API to a PostgreSQL or MongoDB database.
    - Test your API endpoints using Postman or Insomnia.
- **Checkpoint 3:** You should be able to build functional RESTful APIs using Node.js and Express, following a modular architecture and connecting to a database.

**Module 4: Authentication & Authorization - Securing Your API**

- **Theoretical Concepts:**
    - **JWT-Based Auth Flow:** Understanding the process of generating, issuing, and verifying JSON Web Tokens (JWTs) for authentication (access tokens and refresh tokens).
    - **Role-Based Access Control (RBAC):** Implementing different levels of access based on user roles (e.g., admin, user).
    - **Permission-Based Access Control:** Defining granular permissions for specific actions on resources.
    - **Secure Password Handling:** Using `bcrypt` to hash and salt passwords before storing them in the database.
    - **Rate Limiting:** Implementing mechanisms to limit the number of requests a client can make within a specific time frame to prevent abuse.
    - **CORS (Cross-Origin Resource Sharing):** Configuring CORS headers to control which domains can access your API.