1.9 KiB
1.9 KiB
Migration Guide
From v1.x.x to v2.x.x.
Contents
Preparation
Follow Cloudflare's Migration Guide to update your protject to wrangler2.
Update
Update to the latest version verstion
npm i -D @tsndr/cloudflare-worker-router
Import / Require
Switch to ESModules.
Before
const Router = require('@tsndr/cloudflare-worker-router')
After
import Router from '@tsndr/cloudflare-worker-router'
Routes
Just add curly braces.
Before
After
Fetch / router.handle()
❗️ Be aware that with v2.0.0 the parameters of router.handle() changed ❗️



