1
0

add migration guide

This commit is contained in:
2022-06-24 17:29:26 +02:00
parent 8584f88022
commit 7bed1b0dab
2 changed files with 111 additions and 1 deletions

View File

@@ -7,8 +7,11 @@
**USE AT YOUR OWN RISK!**
See [Migration Guide](MIGRATION.md)
---
Cloudflare Workers Router is a super lightweight router (3.6 kB) with middleware support and ZERO dependencies for Cloudflare Workers.
When I was trying out Cloudflare Workers I almost immediately noticed how fast it was compared to other serverless offerings. So I wanted to build a full-fledged API to see how it performs doing real work, but since I wasn't able to find a router that suited my needs I created my own.
@@ -101,6 +104,7 @@ export default {
Enable or disable debug mode. Which will return the `error.stack` in case of an exception instead of and empty `500` response. Debug mode is disabled by default.
#### `state`
State is a `boolean` which determines if debug mode should be enabled or not (default: `true`)
@@ -109,6 +113,7 @@ State is a `boolean` which determines if debug mode should be enabled or not (de
Register a global middleware handler.
#### `handler` (function)
Handler is a `function` which will be called for every request.
@@ -118,6 +123,7 @@ Handler is a `function` which will be called for every request.
If enabled will overwrite other `OPTIONS` requests.
#### `config` (object, optional)
Key | Type | Default Value
@@ -145,6 +151,7 @@ Key | Type | Default Value
The URL starting with a `/`.
Supports the use of dynamic parameters, prefixed with a `:` (i.e. `/user/:userId/edit`) which will be available through the [`req`-Object](#req-object) (i.e. `req.params.userId`).
#### `handlers` (function, optional)
An unlimited number of functions getting [`req`](#req-object) and [`res`](#res-object) passed into them.
@@ -212,4 +219,4 @@ If you already have a wrangler project you can install the router like this:
```
npm i @tsndr/cloudflare-worker-router@pre
```
```