var express = require('express');
var app = express();
var formidable = require('formidable');
app.get("/list",function(req,res){
var form = new formidable.IncomingForm();
form.parse(req,(err,fields,files)=>{
console.log(req.query);//针对get请求
console.log(fields);//针对post请求
res.header("Access-Control-Allow-Origin","*");
res.json({
"id":"170",
"name":'xioaming',
"age":"19"
})
})
})
app.listen(3000)
console.log('服务器开始运行!')
网友评论