Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno_nest/src/guard.ts>SetMetadata

Refer to nestjs to realize some common functions for Deno, support hono and oak
Go to Latest
function SetMetadata
import { SetMetadata } from "https://deno.land/x/deno_nest@v3.5.2/src/guard.ts";

Decorator that assigns metadata to the class/function using the specified key.

Requires two parameters:

  • key - a value defining the key under which the metadata is stored
  • value - metadata to be associated with key

This metadata can be reflected using the Reflector class.

Example: @SetMetadata('roles', ['admin'])

Type Parameters

optional
K = string
optional
V = any

Parameters

metadataKey: K
metadataValue: V