api-proxy-samicelus

1.0.3 • Public • Published

适用于模块化API网关的node.js sdk, 需配合consultModulation图形化web端使用

安装

npm i api-proxy-samicelus

需求

  • mongodb数据库
  • redis
  • 在consultModulation图形化web端定制你的api

使用

//引入包,配置数据库和缓存连接
const api = require('api-proxy-samicelus')(
    {
        mongoConfig:{
            host:'127.0.0.1',
            port: 27017,
            db: 'test'
        },
        redisConfig:{
            host: '127.0.0.1',
            port: 6379
        }
    }
)

async function callAPI(options){
    let result = await api.callConfigedApi({
        app_id: options.app_id,
        apiName: options.apiName,
        params: options.params
    console.log(result);
}
//将在控制台输出对应api配置输出

callAPI({
    app_id: "5ebcfb26b5ffe13eac302917" // 在web端预配置的应用id
    apiName: "同步药品目录" // 在web端预配置的api名称
    params: {} // 调用时的入参键值对 JSON格式
})

Readme

Keywords

none

Package Sidebar

Install

npm i api-proxy-samicelus

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

89.7 kB

Total Files

38

Last publish

Collaborators

  • samicelus