therne / Cottage
Simple, fast HTTP router on koa.js.
Stars: ✭ 103
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Cottage
Webgo
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
Stars: ✭ 165 (+60.19%)
Mutual labels: web-framework, router
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (+138.83%)
Mutual labels: web-framework, router
Grip
The microframework for writing powerful web applications.
Stars: ✭ 137 (+33.01%)
Mutual labels: web-framework, router
Openapi Backend
Build, Validate, Route, Authenticate and Mock using OpenAPI
Stars: ✭ 216 (+109.71%)
Mutual labels: koa, router
Joi Router
Configurable, input and output validated routing for koa
Stars: ✭ 418 (+305.83%)
Mutual labels: koa, router
Koa Dec Router
An ES6 decorator + class based router, support inherit, override, priority, auto load controllers, etc.
Stars: ✭ 19 (-81.55%)
Mutual labels: koa, router
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (+107.77%)
Mutual labels: web-framework, router
koa
A golang framework like koa.js and has the best performance with net/http.
Stars: ✭ 30 (-70.87%)
Mutual labels: koa, web-framework
Routing Controllers
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage in Express / Koa using TypeScript and Routing Controllers Framework.
Stars: ✭ 3,557 (+3353.4%)
Mutual labels: web-framework, router
Iris
The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |
Stars: ✭ 21,587 (+20858.25%)
Mutual labels: web-framework, router
Koatty
Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.
Stars: ✭ 67 (-34.95%)
Mutual labels: koa, router
Koa Oai Router
Koa Router, based on OpenAPI, Swagger and Json Schema.
Stars: ✭ 97 (-5.83%)
Mutual labels: koa
Phprouter
PhpRouter is a powerful, minimal, and very fast HTTP URL router for PHP projects
Stars: ✭ 97 (-5.83%)
Mutual labels: router
Koa Mobx React Starter
A straightforward starter for Node javascript web projects. Using Koa, MobX and ReactJS (with universal / isomorphic server rendering)
Stars: ✭ 102 (-0.97%)
Mutual labels: koa
Fast Path Lede Openwrt
PLEASE GO TO NEW OPENWRT TRUNK BASED SFE FIRMWARE ->
Stars: ✭ 96 (-6.8%)
Mutual labels: router
Cottage is the fastest, simple, and intuitive HTTP router framework for Koa.js.
- Fastest HTTP Router / Framework on Node - See performance
- Simple code - Aren't you tired using
res.send
orctx.body
? Why can't we justreturn
the response? - Additional Sugar Features
Installation
Cottage requires Node v8.0.0 or higher.
$ npm install cottage
Example
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.use(anyKoaMiddleware());
(new Koa).use(app.callback()).listen(...);
// or a simple shorthand without importing Koa.
app.listen(8080, () => console.log('Independent!'));
Performance
Benchmark have been ran on Intel Xeon E3-1250v3 @ 3.50ghz with Node.js 6.1.0 single instance. Tested from Github API sample using wrk
Framework | Mean Throughput (req/sec) | Stddev |
---|---|---|
[email protected] | 15130.12 | 142.45 |
[email protected] | 11455.67 | 201.95 |
[email protected] | 12279.01 | 157.33 |
[email protected] | 2402.31 | 53.14 |
As the benchmark result shows, cottage is the fastest framework in Node.js.
Why?
Cottage uses Radix Tree for URL routing, which is faster than any other data structures. Also, cottage uses technique called "middleware precomposition", which precomposes middleware only at first time, not the every runtime.
Documentations
License: MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].