syd-apirouter

1.1.2 • Public • Published

syd-apirouter

基于koa-router, 自动加载项目api文件夹下的所有js文件为api接口

api文件夹下的js文件写法

const api = async function (json_in, json_out, ctx) {
    switch (json_in.cmd) {
        case 'get_openid':
            {
                json_out.data='返回数据';
            }
            break;
        default:
            throw new Error('未处理的cmd:' + json_in.cmd);
            //break;
    }
};

module.exports = api;

Readme

Keywords

none

Package Sidebar

Install

npm i syd-apirouter

Weekly Downloads

2

Version

1.1.2

License

ISC

Unpacked Size

8.56 kB

Total Files

3

Last publish

Collaborators

  • shengxq