Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/alosaur/src/decorator/QueryParam.ts

Alosaur - Deno web framework with many decorators
Go to Latest
File
import { getOrSetControllerId } from "../metadata/controller.ts";import { getMetadataArgsStorage } from "../mod.ts";import { ParamType } from "../types/param.ts";import { ClassMethodDecoratorContext } from "./decorator.models.ts";
/** * Injects a request's query parameter value to the controller action parameter. * Must be applied on a controller action parameter. */export function QueryParam(name: string): Function { return function (object: Object, context: ClassMethodDecoratorContext, index: number) { const controllerId = getOrSetControllerId(context);
getMetadataArgsStorage().params.push({ type: ParamType.Query, target: object.constructor, method: context.name as string, index: index, name: name, controllerId: controllerId, }); };}