Tag: Node.js

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

0

npm and package

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

0

Publish package

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

0

Package structure

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: