赞
踩
npm install express-generator -g
express --view=ejs server
cd server
npm install
npm start
http://127.0.0.1:3000/
看是否已经启动 var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
router.get('/api/index_list/data', function(req, res, next) {
// res.render('index', { title: 'Express' });
res.json({
"a":1
});
});
module.exports = router;
onLoad() {
// 请求接口数据
uni.request({
url:"http://127.0.0.1:3000/api/index_list/data",
success: (res) => {
console.log(res.data.a);
}
})
},
查看ip
mac :ifconfig
windows :ipconfig
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。