1
0

5 Commits

Author SHA1 Message Date
d3b86f1dbe 2.2.0 2022-10-03 00:34:06 +02:00
aadb398b48 drop default export 2022-10-03 00:32:54 +02:00
5fa3475a20 2.1.2 2022-10-03 00:13:59 +02:00
0637549e90 remove compatibility box 2022-10-03 00:13:51 +02:00
f3279e71fc typo fix 2022-10-03 00:09:03 +02:00
4 changed files with 10 additions and 24 deletions

View File

@@ -19,12 +19,12 @@ I worked a lot with [Express.js](https://expressjs.com/) in the past and really
### Simple Example ### Simple Example
```javascript ```javascript
import Router from '@tsndr/cloudflare-worker-router' import { Router } from '@tsndr/cloudflare-worker-router'
// Initialize router // Initialize router
const router = new Router() const router = new Router()
// Enabling buildin CORS support // Enabling build in CORS support
router.cors() router.cors()
// Register global middleware // Register global middleware
@@ -180,21 +180,7 @@ Key | Type | Description
## Setup ## Setup
--- Please follow Cloudflare's [Get started guide](https://developers.cloudflare.com/workers/get-started/guide/) to install wrangler, then install the router using this command:
### ❗️ Compatibility ❗️
CLI Tool | Router
-------- | ------
[wrangler2](https://github.com/cloudflare/wrangler2#readme) | Use `v2.x.x` or later.
[@cloudflare/wrangler](https://github.com/cloudflare/wrangler#readme) | Use `v1.x.x`, [here](https://github.com/tsndr/cloudflare-worker-router/tree/legacy#readme).
See [Migration from v1.x.x to v2.x.x](https://github.com/tsndr/cloudflare-worker-router/blob/main/MIGRATION.md#migration-guide) if you want to update.
---
### **[Wrangler2](https://github.com/cloudflare/wrangler2#readme)**
Please follow Cloudflare's [Get started guide](https://developers.cloudflare.com/workers/get-started/guide/), then install the router using this command
```bash ```bash
npm i -D @tsndr/cloudflare-worker-router npm i -D @tsndr/cloudflare-worker-router
@@ -206,7 +192,7 @@ and replace your `index.ts` / `index.js` with one of the following scripts
<summary>TypeScript (<code>src/index.ts</code>)</summary> <summary>TypeScript (<code>src/index.ts</code>)</summary>
```typescript ```typescript
import Router from '@tsndr/cloudflare-worker-router' import { Router } from '@tsndr/cloudflare-worker-router'
export interface Env { export interface Env {
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/ // Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
@@ -235,7 +221,7 @@ export default {
<summary>JavaScript (<code>src/index.js</code>)</summary> <summary>JavaScript (<code>src/index.js</code>)</summary>
```javascript ```javascript
import Router from '@tsndr/cloudflare-worker-router' import { Router } from '@tsndr/cloudflare-worker-router'
const router = new Router() const router = new Router()
@@ -247,4 +233,4 @@ export default {
} }
} }
``` ```
</details> </details>

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@tsndr/cloudflare-worker-router", "name": "@tsndr/cloudflare-worker-router",
"version": "2.1.1", "version": "2.2.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@tsndr/cloudflare-worker-router", "name": "@tsndr/cloudflare-worker-router",
"version": "2.1.1", "version": "2.2.0",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@cloudflare/workers-types": "^3.13.0", "@cloudflare/workers-types": "^3.13.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@tsndr/cloudflare-worker-router", "name": "@tsndr/cloudflare-worker-router",
"version": "2.1.1", "version": "2.2.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",

View File

@@ -131,7 +131,7 @@ export interface RouterCorsConfig {
* @public * @public
* @class * @class
*/ */
export default class Router { export class Router {
/** /**
* Router Array * Router Array