# Migration Guide From `v1.x.x` to `v2.x.x`. ## Contents - [Preparation](#preparation) - [Update](#update) - [Import / Require](#import--require) - [Routes](#routes) - [Fetch](#fetch--routerhandle) ## Preparation Follow Cloudflare's [Migration Guide](https://developers.cloudflare.com/workers/wrangler/migration/migrating-from-wrangler-1/) to update your protject to [wrangler2](https://github.com/cloudflare/wrangler2). ## Update Update to the latest version verstion ```bash npm i -D @tsndr/cloudflare-worker-router ``` ## Import / Require Switch to ESModules. ### Before ```javascript const Router = require('@tsndr/cloudflare-worker-router') ``` ### After ```javascript import Router from '@tsndr/cloudflare-worker-router' ``` ## Routes Just add curly braces. ### Before Petrify 2022-06-24 at 5 57 01 PM ### After Petrify 2022-06-24 at 5 55 56 PM ## Fetch / `router.handle()` ❗️ Be aware that with `v2.0.0` the parameters of `router.handle()` changed ❗️ ### Before Petrify 2022-06-24 at 5 58 43 PM ### After Petrify 2022-06-24 at 5 59 22 PM