{"repo":"tsndr/cloudflare-worker-router","free":true,"listed":false,"github":"https://github.com/tsndr/cloudflare-worker-router","clone":"git clone https://github.com/tsndr/cloudflare-worker-router.git","description":"A super lightweight router (1.0K) with middleware support and ZERO dependencies for Cloudflare Workers.","language":"TypeScript","stars":259,"topics":["cloudflare","cloudflare-worker","cloudflare-workers","framework","middleware","router","routing","worker","workers","api"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Cloudflare Workers Router Cloudflare Workers Router is a super lightweight router (1.0K gzipped) 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. Contents - Features - Usage - Reference - Getting started Features - ZERO dependencies - Lightweight (1.0K gzipped) - Fully written in TypeScript - Built specifically around Middlewares - Debug-Mode, CORS and Bearer helpers - Allows accessing request body multiple times Usage Migrating from v2.x.x , check out the Migration Guide. TypeScript Example JavaScript Example Reference router.debug([state = true]) 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 ) Key Type Default Value ---------------------- --------- ------------- state boolean true router.use([...handlers]) Register a global middleware handler. handler(ctx) Handler is a function which will be called for every request. ctx Object containing env , req router.cors([config]) If enabled will overwrite other OPTIONS requests. config (object, optional) Key Type Default Value -","default_branch":null,"files":null,"tree":[],"storefront":"/r/tsndr","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tsndr/cloudflare-worker-router/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}