当前位置:网站首页>Express framework installation and start service

Express framework installation and start service

2022-06-23 01:30:00 hacalili

One 、 install :

First of all to node.js Download... On the official website node

Enter the following command to check whether the installation is successful

npm -v

  If the version number is displayed, the installation is successful

npm init --yes

npm i express

Two 、 establish express_test.js file

//  introduce 
const { request } = require('express');
//  Create application objects 
const express = require('express');
//  Create application objects 
const app = express();
//  Create routing rules 
app.get('/',(request,response) => {
    response.send('hello express~');
});
//  Listening port starts service 
app.listen(8000,() => {
    console.log(" Service started ,8000 Port monitoring ...");
})

3、 ... and 、cmd Start service in window

node express_test.js

 

原网站

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