【文件属性】:
文件名称:Cottage:koa.js上的简单,快速HTTP路由器
文件大小:58KB
文件格式:ZIP
更新时间:2021-02-03 14:45:54
nodejs koa router web-framework microserver
Cottage是最快,简单,直观的HTTP路由器框架。
节点上最快的HTTP路由器/框架-查看
简单的代码-使用res.send或ctx.body不会感到厌倦? 我们为什么不能只return响应?
安装
Cottage需要 v8.0.0或更高版本。
$ npm install cottage
例
import { Cottage , Response } from 'cottage' ;
const app = new Cottage ( ) ;
// just simple return would be enough
app . post ( '/' , async ctx => 'Hello world!' ) ;
app . get ( '/auth' , async ctx => {
// needs fancy response code?
return new Response ( 401 , { error : 'unauthorized' } ) ;
} ) ;
// cottage is built on the top of Koa.
app
【文件预览】:
cottage-master
----.travis.yml(86B)
----index.js(714B)
----package.json(1KB)
----test()
--------nested_router.js(2KB)
--------testutil.js(1KB)
--------middleware.js(4KB)
--------apis()
--------api.js(1KB)
--------router.js(3KB)
--------response.js(1KB)
----package-lock.json(83KB)
----index.d.ts(10KB)
----examples()
--------memo()
--------slack-logger()
----.gitignore(86B)
----lib()
--------Application.js(602B)
--------Router.js(8KB)
--------Node.js(5KB)
--------Response.js(1KB)
--------default-handler.js(97B)
--------Tree.js(9KB)
--------Route.js(755B)
--------Layer.js(910B)
--------composer.js(2KB)
----.nycrc.json(33B)
----README.md(3KB)
----.editorconfig(241B)