Compare commits
18 Commits
1b2956b437
...
v3.2.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
5aedc0248d
|
|||
|
3aecc4ca5f
|
|||
|
e04bcfb395
|
|||
|
f2ba5f5bc5
|
|||
|
306c046adb
|
|||
|
2dab64be19
|
|||
|
175deddc9c
|
|||
|
ff638ad04f
|
|||
|
b118c28dc7
|
|||
|
9451f466fc
|
|||
|
71fcd6c3c0
|
|||
|
e55392d890
|
|||
|
3aaecd8877
|
|||
|
d8d13c4339
|
|||
|
09d5586cc6
|
|||
|
110bfdd95c
|
|||
|
c68a979614
|
|||
|
a4fd646d6b
|
6
.github/workflows/publish-main.yml
vendored
6
.github/workflows/publish-main.yml
vendored
@@ -1,8 +1,8 @@
|
||||
name: Publish (main)
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
@@ -28,4 +28,4 @@ jobs:
|
||||
- name: Publish to GPR
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
run: npm publish --tag latest --access public
|
||||
run: npm publish --tag latest --access public
|
||||
21
.github/workflows/test.yml
vendored
Normal file
21
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
11
.npmignore
11
.npmignore
@@ -1,7 +1,10 @@
|
||||
.editorconfig
|
||||
.github/
|
||||
src/
|
||||
test/
|
||||
.gitignore
|
||||
.nvmrc
|
||||
coverage/
|
||||
jest.config.ts
|
||||
MIGRATION.md
|
||||
tsconfig.json
|
||||
.editorconfig
|
||||
src/
|
||||
tests/
|
||||
tsconfig.json
|
||||
@@ -240,7 +240,6 @@ Key | Type | Default Value
|
||||
### Supported Methods
|
||||
|
||||
- `router.any(url, [...handlers])`
|
||||
- `router.connect(url, [...handlers])`
|
||||
- `router.delete(url, [...handlers])`
|
||||
- `router.get(url, [...handlers])`
|
||||
- `router.head(url, [...handlers])`
|
||||
@@ -248,7 +247,6 @@ Key | Type | Default Value
|
||||
- `router.patch(url, [...handlers])`
|
||||
- `router.post(url, [...handlers])`
|
||||
- `router.put(url, [...handlers])`
|
||||
- `router.trace(url, [...handlers])`
|
||||
|
||||
|
||||
#### `url` (string)
|
||||
@@ -410,4 +408,4 @@ export default {
|
||||
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",
|
||||
"version": "3.1.3",
|
||||
"version": "3.2.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@tsndr/cloudflare-worker-router",
|
||||
"version": "3.1.3",
|
||||
"version": "3.2.4",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^4.20231025.0",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"name": "@tsndr/cloudflare-worker-router",
|
||||
"version": "3.1.3",
|
||||
"version": "3.2.4",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
"build": "tsc",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
22
src/index.ts
22
src/index.ts
@@ -175,17 +175,6 @@ export class Router<Env = any, CtxExt = {}, ReqExt = {}> {
|
||||
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
|
||||
*
|
||||
@@ -263,17 +252,6 @@ export class Router<Env = any, CtxExt = {}, ReqExt = {}> {
|
||||
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
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from '@jest/globals'
|
||||
import { Router } from '.'
|
||||
import { Router } from '../src/index'
|
||||
|
||||
describe('Router', () => {
|
||||
test('use', async () => {
|
||||
Reference in New Issue
Block a user