代码拉取完成,页面将自动刷新
var express = require("express");
const path = require('path')
var app = express();
app.use(express.static(path.join(__dirname,'')))
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', "*");
next();
});
app.get("/", function(req, res) {
res.sendFile('./index.html')
});
// require("./test/routes1")(app)
// require("./test/routes2")(app)
app.use((req,res,next)=>{
console.log('--');
next()
return
console.log('--sss');
});
app.get("/candies",(req,res)=>{
res.send({a:"big white bunny"});
});
app.get("/bottles", (req, res) => {
res.send({ b:"a bottle of water" });
});
app.post("/user/:id", function(req, res) {
/* some server side logic */
res.send("OK");
});
app.post("/stuff",function(req,res){
console.log(req);
res.send({"a":"b"});
})
var port = 8023;
app.listen(port, function() {
console.log("Listening on " + port);
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。