当前位置:网站首页>Project Background Technology Express

Project Background Technology Express

2022-08-02 02:01:00 matcha life

Introduce three aspects:

One, the installation and use of Express;

Second, the routing definition of the Express project;

Three, the static resource management of Express project;

One, the installation and use of Express

Express Application Builder

1. Quickly create an application framework

npm install express-generator -g

After creating, you can use express -h to view the common commands of express

2. Create a new express application and build an Express server application that does not include template display function

express --no-view myapp

3. Install dependencies according to the command prompt

Second, the routing provided by Express

Express provides routes. By defining routes, you can design different URI addresses and support various HTTP methods (including GET, POST and other request methods)

An error is encountered here is that the routing request cannot be get

Install Mongodb

npm install mongoose -save

Add the following file in app.js

Start myapp

set DEBUG=myapp * & npm start

原网站

版权声明
本文为[matcha life]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/214/202208020155491171.html