How to access env from router.post? #126
-
Hi I have been trying to implement D1 update using HTTP Post. When I look up the docs, I cannot find any example with itty-router's http POST function accpting env argument. I need the env argument to access the D1 and other resources. It will be very helpful if there is example for this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Link is right there! :) Basically, anything you pass into a |
Beta Was this translation helpful? Give feedback.
Link is right there! :)
https://github.com/kwhitley/itty-router#cf-es6-module-syntax
Basically, anything you pass into a
router.handle
will be the args presented to each handler downstream. If you pass in all the...args
from cloudflare's fetch,env
will naturally be the second param, andcontext
the third. Otherwise, it's all up to you!