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
Derek Zhu
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
Create interface steps (summarize previous lessons) Create the basic server: app.js 123456const express = require('express')const app = express()//main codeapp.listen(80, function(){
Classification of middleware Express officially divides common middleware usage into five categories: Application-level middleware Route-level middleware Error-level middleware Express built-in
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
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
Introduction to Express Express is a fast, open and minimal web development framework based on the Node.js platform. Express is similar to the built-in http module of Node.js, and is specially used
Initialize the basic structure of the package The folder my-package of the new key package, as the root directory of the package In the my-package folder, new key the following three files: pac
Classification of packages Project package: The packages installed in the node_modules directory of the project are all project packages. Project packages can also be subdivided into two categories: