EIEIOTECHNOVATION
← Training programmes

EIEIO / AUTOMATION & EMERGING TECHNOLOGY

API Development with NestJS

Course outline

4 days

Duration

API Development with NestJS

4 days

Overview

NestJS is a progressive Node.js framework for building efficient, reliable, and scalable server-side applications. Leveraging the power of TypeScript, NestJS brings a modern, modular architecture to the backend development world, making it an ideal choice for developers who want to build robust and maintainable applications. Inspired by Angular, it uses decorators and dependency injection extensively, which simplifies the development process and enhances code organization. Whether you're creating microservices or complex enterprise-level applications, NestJS provides the tools and flexibility needed to meet the demands of modern software development.

Course Objective

By the end of this course, participants will be able to:

  • Create and navigate a basic NestJS project, understanding its structure and core components.
  • Develop controllers and define routes to handle various HTTP methods.
  • Implement CRUD (Create, Read, Update, Delete) operations.
  • Create and apply middleware to handle request processing.
  • Implement guards to secure routes through authentication and authorization mechanisms.
  • Integrate and use TypeORM with MySQL for relational databases and MongoDB with Mongoose for schema-based data modeling.
  • Secure applications using JWT (JSON Web Tokens).
  • Apply guards to protect routes and manage user sessions.
  • Apply best practices for deploying and maintaining NestJS applications in a production environment.

Target Participant

This course is designed for developers and software engineers who want to learn how to create RESTful APIs using NestJS.

Program Prerequisites

Participants are expected to be familiar JavaScript and have worked with Server Side Programming language before, eg PHP, .Net or Java

Mode of Delivery

Every participant will be provided with course notes.

Course Content

  • 1. Nest.js, benefits and Setting Up the Development Environment
  • Introduction to Nest.js
  • Installing Node.js and npm
  • Installing the Nest CLI
  • Creating your first NestJS project
  • 2. Project Structure and Main Components
  • Overview of project files and directories
  • Detailed walkthrough of the main.ts file
  • Generating and understanding a NestJS module
  • Hands-on Lab
  • Create a basic NestJS application
  • Generate a module and explore the generated files
  • Explore the official NestJS documentation
  • Experiment with generating additional modules
  • 3. Building RESTful APIs
  • Controllers and Routing
  • Generating a controller
  • Defining routes and handling HTTP methods
  • Handling Requests and Data Transfer Objects (DTOs)
  • Managing POST requests
  • Using DTOs to define request bodies
  • Adding validation to request data
  • Working with route parameters and query parameters
  • 4. Services and Dependency Injection
  • Creating and using services
  • Understanding providers and dependency injection
  • Build a simple CRUD API
  • Implement route and query parameters, DTOs, and validation
  • 5. Middleware
  • Creating and applying middleware
  • Use cases and best practices for middleware
  • 6. Pipes and Transformations
  • Creating and using pipes
  • Transforming and validating data with pipe
  • 7. Guards and Route Protection
  • Implementing guards for authentication and authorization
  • Creating custom guards
  • 8. Working with Relational Databases
  • Setting up TypeORM with MySQL
  • Defining entities and repositories
  • Advanced TypeORM Features
  • Managing relationships between entities
  • Using query builders and custom repository methods
  • 9. Authentication in NestJS
  • Implementing JWT-based authentication
  • Securing routes with guards and JWT
  • 10. Deployment
  • Creating Dockerfiles for NestJS and MySQL
  • Docker Compose for multi-container applications
  • Best practices for deploying NestJS applications
  • Deploying to cloud platforms (Heroku, AWS, etc.)

Programme scope, delivery arrangements and suitability are confirmed during enquiry.