Savory / Danet

The most mature backend framework for Deno. Create awesome HTTP and WebSocket server as well as KVQueue workers !
https://danet.land
Other
269 stars 18 forks source link

Access controller/method in context #57

Closed Sorikairox closed 1 year ago

Sorikairox commented 1 year ago

Is your feature request related to a problem? Please describe.

Let's say I have a global AuthGuard because almost all my routes need authentication. The few that don't need it should have a decorator such as @Public that set metadata.

In my global AuthGuard, I should be able to get a reference to the Method (via ctx) to get access to its metadata.

Describe the solution you'd like

In router/router.ts:handleRoute, we should add Controller and ControllerMethod in ctx !

Additional context

Maybe something similar to NestJS

 ctx.getHandler(),
 ctx.getClass(),