Skip to main content

Built and signed on GitHub Actions

TypeScript Decorators for easy scaffolding API services with the oak framework (jsr:@oak/oak)

This package works with Cloudflare Workers, Node.js, Deno, Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
3 days ago (0.12.1)
function ControllerMethodArgs
ControllerMethodArgs(...desirableParams: ControllerMethodArg[]): unknown

Decorator that should be used on the Controller Method when we need to refer to the request body, param, query, etc. in the Method Body

Examples

Example 1

(@)Controller("/api/v1")
class MyClass {
  (@)Post("/:resource")
  (@)ControllerMethodArgs("body", "query", "param")
  doSomething(body, query, param, ctx): void {
    console.log(`endpoint called: /api/v1/${ctx.params.resource}`);
    console.log(`now let's do something with`, body, query, param);
  }
}

Parameters

...desirableParams: ControllerMethodArg[]

Return Type

unknown

a function with the signature (arguments) matching that of the provided desirableParams, which can then be decorated with one of the Class Method decorators (e.g. Get, Post, etc.)

Add Package

deno add jsr:@dklab/oak-routing-ctrl

Import symbol

import { ControllerMethodArgs } from "@dklab/oak-routing-ctrl";

---- OR ----

Import directly with a jsr specifier

import { ControllerMethodArgs } from "jsr:@dklab/oak-routing-ctrl";

Add Package

npx jsr add @dklab/oak-routing-ctrl

Import symbol

import { ControllerMethodArgs } from "@dklab/oak-routing-ctrl";

Add Package

yarn dlx jsr add @dklab/oak-routing-ctrl

Import symbol

import { ControllerMethodArgs } from "@dklab/oak-routing-ctrl";

Add Package

pnpm dlx jsr add @dklab/oak-routing-ctrl

Import symbol

import { ControllerMethodArgs } from "@dklab/oak-routing-ctrl";

Add Package

bunx jsr add @dklab/oak-routing-ctrl

Import symbol

import { ControllerMethodArgs } from "@dklab/oak-routing-ctrl";