Closed vody closed 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!)
@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))
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).
👍 👍 👍