const express = require('express');
const app= express();
//在post请求中,express本身不能解析请求体里的参数,需要用到'body-parser'插件
const bodypaser = require('body-parser')
//解析www-form-urlencoded格式的数据
app.use(bodypaser.urlencoded({extend:false}))
//解析json格式的数据
app.use(bodypaser.json())
app.post('/user/login', (req, res)=>{
//get方式通过req.query获取前端传递的参数
//post方式通过req.body获取前端传递的参数
res.send('Hello world');
});
app.listen(8089, ()=>{
console.log('Server is running at http://localhost:8083')
})