在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:saadq/koa-combine-routers开源软件地址:https://github.com/saadq/koa-combine-routers开源编程语言:JavaScript 65.9%开源软件介绍:koa-combine-routersConvenience middleware for composing multiple instances of koa-router. For usage with Koa 1.X, check out the Installation
Usageapp.js const Koa = require('koa')
const router = require('./routes')
const app = new Koa()
app.use(router()) routes.js const Router = require('koa-router')
const combineRouters = require('koa-combine-routers')
const dogRouter = new Router()
const catRouter = new Router()
dogRouter.get('/dogs', async ctx => {
ctx.body = 'ok'
})
catRouter.get('/cats', async ctx => {
ctx.body = 'ok'
})
const router = combineRouters(
dogRouter,
catRouter
)
module.exports = router API
combineRouters(routers)combineRouters(...routers) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论