将mssql的sql、pro转为webapi
$ npm i egg-mssql2webapi --save
// {app_root}/config/plugin.js
exports.mssql2webapi = {
enable: true,
package: 'egg-mssql2webapi',
};
// {app_root}/config/config.default.js
exports.mssql2webapi = {
urlprefix: '/api/',
apitable: {
emr: {// api/emr/
db: {
server: 'd.vy01.com',
user: 'sa',
password: 'test.123456',
database: 'db1',
},
apis: [{
name: 'getuser', //http://127.0.0.1:7001/api/emr/getuser?usercode=2
sql: 'api_getuser',
type: 'pro',
result:'object'
}, {
name: 'findusers',//http://127.0.0.1:7001/api/emr/findusers
sql: 'select * from users where objectstatus>0',
type: 'sql',
result:'array'
}],
},
ris: {
db: {},
apis: [],
},
},
};
http://127.0.0.1:7001/api/emr/getuser?usercode=2
http://127.0.0.1:7001/api/emr/findusers
see config/config.default.js for more detail.
Please open an issue here.