npm.io
1.0.3 • Published 2 years ago

tcb-function-router

Licence
ISC
Version
1.0.3
Deps
0
Size
22 kB
Vulns
0
Weekly
0

刚学js、ts,根据个人使用习惯改写了 simple-cloudbase-router

https://www.npmjs.com/package/simple-cloudbase-router
https://github.com/sonofmagic/simple-cloudbase-router
// 云函数的 index.js
const app = require("./src/index");
const router = app.compose([
  // 全局中间件处理
  async (ctx, next) => {
    ctx.body = "Hello router!";
    await next();
  },
]);
exports.main = async (event, context) => {
  return await app.run(event, context,router);
};