Open mowatermelon opened 4 years ago
https://github.com/koajs/router
npm
依赖包地址
https://www.npmjs.com/package/koa-router
在线运行地址
https://npm.runkit.com/koa-router
npm install @koa/router --save # npm yarn add @koa/router # Yarn
router.get|put|post|patch|delete|del ⇒ Router
const Koa = require('koa'); const Router = require('@koa/router'); const app = new Koa(); const router = new Router(); router.get('/', (ctx, next) => { // ctx.router available }); app .use(router.routes()) .use(router.allowedMethods());
koa-router
官方仓库
https://github.com/koajs/router
官方
npm
地址https://www.npmjs.com/package/koa-router
https://npm.runkit.com/koa-router
基础介绍
基础安装
基础使用