提供了以下mock接口的demo,更多源码请下载附件信息
const compuser_data = '/api/compuser/data';
const compuser_findById = '/api/compuser/findById';
const compuser_save = '/api/compuser/save';
const compuser_del = '/api/compuser/del';
const userinfo = '/api/userinfo';
const query = '/user/query';
const page = '/user/page';
const find = '/user/findById';
const del = '/user/del';
/*
mockjs语法参考官网http://mockjs.com/
*/
const Mock = require('mockjs');
const userinfo = '/api/userinfo';
const loginData = Mock.mock({
username: 'guest',
sex: '男',
age: 18
});
module.exports = {
[`POST ${userinfo}`](req, res) {
res.json(loginData);
},
[`GET ${userinfo}`](req, res) {
res.json(loginData);
}
};
1