Skip to content

shz8/egg-mssql2webapi

Repository files navigation

egg-mssql2webapi

NPM version build status Test coverage David deps Known Vulnerabilities npm download

将mssql的sql、pro转为webapi

Install

$ npm i egg-mssql2webapi --save

Usage

// {app_root}/config/plugin.js
exports.mssql2webapi = {
  enable: true,
  package: 'egg-mssql2webapi',
};

Configuration

// {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.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

About

mssql转为webapi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published