@tinyhttp/router
Advanced tools
Comparing version 0.5.1 to 0.5.2
# @tinyhttp/router | ||
## 0.5.2 | ||
### Patch Changes | ||
- Fix `router.all` | ||
## 0.5.1 | ||
@@ -4,0 +10,0 @@ |
@@ -34,2 +34,3 @@ /// <reference types="node" /> | ||
apps: Record<string, App>; | ||
route(path: string): App; | ||
get(...args: RouterMethodParams<Req, Res>): this; | ||
@@ -36,0 +37,0 @@ post(...args: RouterMethodParams<Req, Res>): this; |
@@ -33,2 +33,7 @@ import { METHODS } from 'http'; | ||
} | ||
route(path) { | ||
const router = new Router(); | ||
this.use(path, router); | ||
return router; | ||
} | ||
get(...args) { | ||
@@ -377,3 +382,5 @@ pushMiddleware(this.middleware)({ | ||
pushMiddleware(this.middleware)({ | ||
...args, | ||
path: args[0], | ||
handler: args[1], | ||
handlers: args.slice(2), | ||
method, | ||
@@ -380,0 +387,0 @@ type: 'route', |
{ | ||
"name": "@tinyhttp/router", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Router for tinyhttp", |
@@ -134,2 +134,10 @@ import { METHODS, IncomingMessage as I, ServerResponse as R } from 'http' | ||
route(path: string): App { | ||
const router = new Router<App, Req, Res>() | ||
this.use(path, router as App) | ||
return router as App | ||
} | ||
get(...args: RouterMethodParams<Req, Res>) { | ||
@@ -479,3 +487,5 @@ pushMiddleware<Req, Res>(this.middleware)({ | ||
pushMiddleware(this.middleware)({ | ||
...args, | ||
path: args[0], | ||
handler: args[1], | ||
handlers: args.slice(2) as Handler<Req, Res>[], | ||
method, | ||
@@ -482,0 +492,0 @@ type: 'route', |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52425
1624