router
router copied to clipboard
Unsure how to handle env variables
It'd be really helpful if the docs mentioned how to use env vars.
I can confirm that without this library, env.SOME_KEY
does logged, however, as soon as I export router
then the env
item in my handler callback doesn't have that value.
Thanks for an awesome library btw.
Access to environmental variables depends on runtime you are using. If you are using Cloudflare Workers, bindings and environmental variables should be available in handler context:
.put('/:flow_id', async (req, ctx) => {
ctx.env.KV
return new JSONResponse({})
})