Open repzip opened 3 years ago
I spent few moments with same thing and came up with this:
import {
[...]
withParams,
withContent,
} from "itty-router-extras";
[...]
router.post("/test/:id", withParams, withContent,
async({content,DurableObject,id}) => {
console.log(`This is ${content} with id ${id}`);
const object = DurableObjects.get(id);
return object.toJSON();
});
Hold on, let me dust the cobwebs off! I know there's a way because this was obv a common use-case (have to be able to use other KV/durables from within a durable, for instance) :)
I had to shelve this temporarily (I'll be back, because I need it) for a death in the family :'(
Terribly sorry to hear that, my condolences. I will mess around with it today and try figure it out.
Post methods dont work?
Post methods dont work?
Just in example, route with withDurable - is 'get' - just change it to 'all' ;)
router .all('*', withDurables())
Great module... I have spent a good bit of time trying to figure out how to pass params and request object into methods of the Durable Object?
Any help would be great.
Thanks.