Compare commits
3 Commits
v3.2.1
...
1b2956b437
| Author | SHA1 | Date | |
|---|---|---|---|
|
1b2956b437
|
|||
|
64458ca755
|
|||
|
eeea1102af
|
@@ -240,6 +240,7 @@ Key | Type | Default Value
|
|||||||
### Supported Methods
|
### Supported Methods
|
||||||
|
|
||||||
- `router.any(url, [...handlers])`
|
- `router.any(url, [...handlers])`
|
||||||
|
- `router.connect(url, [...handlers])`
|
||||||
- `router.delete(url, [...handlers])`
|
- `router.delete(url, [...handlers])`
|
||||||
- `router.get(url, [...handlers])`
|
- `router.get(url, [...handlers])`
|
||||||
- `router.head(url, [...handlers])`
|
- `router.head(url, [...handlers])`
|
||||||
@@ -247,6 +248,7 @@ Key | Type | Default Value
|
|||||||
- `router.patch(url, [...handlers])`
|
- `router.patch(url, [...handlers])`
|
||||||
- `router.post(url, [...handlers])`
|
- `router.post(url, [...handlers])`
|
||||||
- `router.put(url, [...handlers])`
|
- `router.put(url, [...handlers])`
|
||||||
|
- `router.trace(url, [...handlers])`
|
||||||
|
|
||||||
|
|
||||||
#### `url` (string)
|
#### `url` (string)
|
||||||
@@ -408,4 +410,4 @@ export default {
|
|||||||
return router.handle(request, env, ctx)
|
return router.handle(request, env, ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@tsndr/cloudflare-worker-router",
|
"name": "@tsndr/cloudflare-worker-router",
|
||||||
"version": "3.2.1",
|
"version": "3.1.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@tsndr/cloudflare-worker-router",
|
"name": "@tsndr/cloudflare-worker-router",
|
||||||
"version": "3.2.1",
|
"version": "3.1.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cloudflare/workers-types": "^4.20231025.0",
|
"@cloudflare/workers-types": "^4.20231025.0",
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@tsndr/cloudflare-worker-router",
|
"name": "@tsndr/cloudflare-worker-router",
|
||||||
"version": "3.2.1",
|
"version": "3.1.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc"
|
||||||
"test": "jest"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
22
src/index.ts
22
src/index.ts
@@ -175,6 +175,17 @@ export class Router<Env = any, CtxExt = {}, ReqExt = {}> {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register CONNECT route
|
||||||
|
*
|
||||||
|
* @param {string} url
|
||||||
|
* @param {RouterHandler[]} handlers
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
public connect(url: string, ...handlers: RouterHandler<Env, CtxExt, ReqExt>[]): Router<Env, CtxExt, ReqExt> {
|
||||||
|
return this.register('CONNECT', url, handlers)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register DELETE route
|
* Register DELETE route
|
||||||
*
|
*
|
||||||
@@ -252,6 +263,17 @@ export class Router<Env = any, CtxExt = {}, ReqExt = {}> {
|
|||||||
return this.register('PUT', url, handlers)
|
return this.register('PUT', url, handlers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register TRACE route
|
||||||
|
*
|
||||||
|
* @param {string} url
|
||||||
|
* @param {RouterHandler[]} handlers
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
public trace(url: string, ...handlers: RouterHandler<Env, CtxExt, ReqExt>[]): Router<Env, CtxExt, ReqExt> {
|
||||||
|
return this.register('TRACE', url, handlers)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register route, ignoring method
|
* Register route, ignoring method
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user