Category: Back-end

0

Pagination @Put(), @Delete()

Status code problem Nest will give a default status code of 200 when the request is successful. But we can also customize the status code and return. Nest does not need to memorize all status codes,

0

Controller, @Get(), @Post()

Generate a controller by running the Nest CLI Command: nest generate controller, which can be abbreviated as nest g co. Then enter the name of the controller. (If you don’t want to generate test fil

0

Introduction to Nest.js

Difference between NestJS and NodeJS NestJS is a framework that lets programmers focus on the application problem at hand rather than the tiny implementation details like setting up TypeScript, API

0

Project structure

Create a project First create the src folder in the project folder, then create the entry file index.js in it, then run npm init -y . Then install express, dotenv, cors, morgan, Mongoose packages. n

0

CORS

Interface cross domain problem There are two main solutions to solve the interface cross-domain problem: CORS (mainstream solution, recommended) JSONP (flawed solution, only supports GET requests)

0

Interface (Summary)

Create interface steps (summarize previous lessons) Create the basic server: app.js 123456const express = require('express')const app = express()//main codeapp.listen(80, function(){

0

Middleware classification

Classification of middleware Express officially divides common middleware usage into five categories: Application-level middleware Route-level middleware Error-level middleware Express built-in

0

Middleware

The concept of middleware Middleware refers specifically to the intermediate processing links of business processes. The calling process of Express middleware is that when a request arrives at the E

0

Route

Route Concept Routing is a mapping relationship. In Express, routing refers to the mapping between client requests and server processing functions. The route in Express consists of three parts, whic

0

Host static resources

express.static() express.static() can be very convenient to create a static resource server. It can specify a directory to be hosted as a static resource folder, and can access all files under the d