Table of Contents for
Nest.js: A Progressive Node.js Framework
Close
Version ebook
/
Retour
Nest.js: A Progressive Node.js Framework
by David Guijarro
Published by Bleeding Edge Press, 2018
nav
Cover
Nest.js: A Progressive Node.js Framework
Nest.js: A Progressive Node.js Framework
Preface
1. Introduction
2. Overview
3. Nest.js authentication
4. Dependency Injection system of Nest.js
5. TypeORM
6. Sequelize
7. Mongoose
8. Web sockets
9. Microservices
10. Routing and request handling in Nest.js
11. OpenAPI (Swagger) Specification
12. Command Query Responsibility Separation (CQRS)
13. Architecture
14. Testing
15. Server-side Rendering with Angular Universal
Preface
What is Nest.js?
1. Introduction
Topics discussed
Nest CLI
Dependency Injection
Authentication
ORM
REST API
WebSockets
Microservices
GraphQL
Routing
Nest specific tools
OpenAPI (Swagger)
Command Query Responsibility Segregation (CQRS)
Testing
Server-side rendering with Angular Universal
Summary
2. Overview
Controllers
Providers
Modules
Bootstrapping
Middleware
Guards
Summary
3. Nest.js authentication
Passport
Manual implementation
Implementation
Authentication middleware
Managing restrictions with guards
Nest.js passport package
Summary
4. Dependency Injection system of Nest.js
Overview of Dependency Injection
Why use Dependency Injection
How it works without Dependency Injection
How it works with a manual Dependency Injection
Dependency Injection pattern today
Nest.js Dependency Injection
The difference between Nest.js and Angular DI
Summary
5. TypeORM
What database to use
About MariaDB
Getting started
Start the database
Connect to the database
Initialize TypeORM
Modelling our data
Our first entity
Using our models
The service
The controller
Building a new module
Improving our models
Auto-generated IDs
When was the entry created?
Column types
NoSQL in SQL
Relationships between data models
How to store related entities
Retrieving related entities in bulk
Lazy relationships
Other kinds of relationships
One-to-one
Many-to-many
Advanced TypeORM
Security first
Other listeners
Composing and extending entities
Caching
Building a query
Building our model from a existing database
Summary
6. Sequelize
Configure Sequelize
Create a model
@Table
@column
Create the User model
LifeCycle hooks
Injecting a model into a service
Usage of Sequelize transaction
Migration
Configuring the migration script
Create a migration
Summary
7. Mongoose
A word about MongoDB
A word about Mongoose
Mongoose and Nest.js
Getting started
Set up the database
Start the containers
Connect to the database
Modelling our data
Our first schema
Using the schema
The interface
The service
The controller
The first requests
Relationships
Modelling relationships
Saving relationships
Reading relationships
Summary
8. Web sockets
WebSocketGateway
Gateways
Authentication
Adapter
Client side
Summary
9. Microservices
Server bootstrap
Configuration
First microservice handler
Sending data
Exception filters
Pipes
Guards
Interceptors
Built-in transports
Redis
MQTT
NATS
gRPC
Custom transport
Hybrid application
Advanced architecture design
Summary
10. Routing and request handling in Nest.js
Request handlers
Generating responses
Standard approach
Express approach
Route parameters
Request body
Request object
Asynchronous handlers
Async/await
Promise
Observables
Error responses
HttpException
Unrecognized exceptions
Summary
11. OpenAPI (Swagger) Specification
Document Settings
Documenting authentication
Swagger UI
API input decorators
@Body
@Param
@Query
@Headers
Authentication
API request and response decorators
API metadata decorators
Saving the swagger document
Summary
12. Command Query Responsibility Separation (CQRS)
Entry module commands
Command handlers
Invoking command handlers
Linking keywords with events
Keyword events
Invoking event handlers
Retrieving keywords APIs
Linking keywords with sagas
Keyword saga commands
Keyword saga
Summary
13. Architecture
Style guide of naming conventions
Controller
Service
Module
Middleware
Exception filter
Pipe
Guard
Interceptor
Custom decorator
Gateway
Adapter
Unit test
E2E test
Directory structure
Server architecture
Angular Universal architecture
Summary
14. Testing
Unit testing
Tooling
Preparation
Writing our first test
Testing for equality
Covering our code in tests
E2E testing
Preparation
Writing end-to-end tests
Summary
15. Server-side Rendering with Angular Universal
Serving the Angular Universal App with Nest.js
Building and running the Universal App
Summary