koa-tree-router
Advanced tools
Comparing version
@@ -29,11 +29,41 @@ import * as Koa from "koa"; | ||
constructor(opts?: Router.IRouterOptions); | ||
/** | ||
* Register a new route. | ||
*/ | ||
on(method: string, path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP GET method | ||
*/ | ||
get(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP POST method | ||
*/ | ||
post(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP PUT method | ||
*/ | ||
put(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP DELETE method | ||
*/ | ||
delete(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP HEAD method | ||
*/ | ||
head(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP OPTIONS method | ||
*/ | ||
options(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP PATCH method | ||
*/ | ||
patch(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP TRACE method | ||
*/ | ||
trace(path: string, ...middleware: Array<Router.IMiddleware>); | ||
/** | ||
* HTTP CONNECT method | ||
*/ | ||
connect(path: string, ...middleware: Array<Router.IMiddleware>); | ||
@@ -40,0 +70,0 @@ /** |
{ | ||
"name": "koa-tree-router", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A high performance koa router", | ||
@@ -5,0 +5,0 @@ "main": "router.js", |
10
tree.js
@@ -198,7 +198,3 @@ const STATIC = 0; | ||
STATIC, | ||
numParams, | ||
"", | ||
[], | ||
null, | ||
0 | ||
numParams | ||
); | ||
@@ -290,3 +286,3 @@ n.children.push(child); | ||
const child = new node("", false, PARAM, numParams, "", [], null, 0); | ||
const child = new node("", false, PARAM, numParams); | ||
n.children = [child]; | ||
@@ -339,3 +335,3 @@ n.wildChild = true; | ||
// first node: catchAll node with empty path | ||
const catchAllChild = new node("", true, CATCH_ALL, 1, "", [], null, 0); | ||
const catchAllChild = new node("", true, CATCH_ALL, 1); | ||
n.children = [catchAllChild]; | ||
@@ -342,0 +338,0 @@ n.indices = path[i]; |
20557
1.73%564
5.03%