preface
Create a back-end service using Express
Create a folder
You can create files and folders by right clicking or by using create commands
1.mkdir express
2.touch index.js
Write code to create back-end services
/*
* @Author: Vinc
* @Date: 2021-05-06 09:31:03
* @LastEditTime: 2021-05-06 09:34:04
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \express\index.js
*/
let express = require('express');
let app = express();
app.get('/', (req, res) => {
res.send('Hello World');
})
app.listen(3000, () => {
console.log('service start:', 'http://localhost:3000')
})
Copy the code
Start the process
1. Access the root directory NPM I or CNPM I express-s // Local dependency
2. After downloading the dependency node index.js
3. Open localhost:3000 in the browser
The above is a simple back-end service implementation, we can also try, creation is not easy, thank you for watching