kwhitley / itty-router

A little router.
MIT License
1.79k stars 78 forks source link

Sponsor link is broken #30

Closed vody closed 3 years ago

vody commented 3 years ago

image

kwhitley commented 3 years ago

Haha, yeah I trailed off while setting that up... I mean, is this issue because you actually wanted to sponsor?

(if so, dang, I'm missing opportunities here!)

vody commented 3 years ago

@kwhitley, yes. I had\have this motivation. Using itty-router on worker with ultimate satisfaction and totally impressed with N pages of docs defined for 29 lines of code. Bring sponsor link back. Sure there will be more satisfied users. BTW: Got confused on running anything after response returned and solved by using then(s) maybe worth to document:

event.respondWith(
    router.handle(event.request, event)
      .catch(error)
      .then(setCookie.bind(event))
      .then(setHeaders))
kwhitley commented 3 years ago

Thanks again @vody!!

Also great suggestion on the .then() chain for response modification/finalization... that would prob be a better pattern for headers (e.g. CORS) than always trying to intercept with upstream middleware (which certainly also has its use).

👍 👍 👍