D
Deno

help

Adding methods to Oak's Context?

Aabi5/11/2023
I am trying to figure out how to configure my Oak application/router so that my routes can do things like ctx.customMethod(), could someone point me in the right direction? I can only really find how to customize the State, but that would only let me do ctx.state.customMethod() – is that how you're supposed to do it instead of what I had in mind? The reason why I'd rather do ctx.customMethod() is because customMethod is supposed to do things with the current request and/or response, so it would seem more fitting in the Context type?

Looking for more? Join the community!