Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

nest js decorator

import { createParamDecorator, ExecutionContext } from '@nestjs/common';

export const User = createParamDecorator(
  (data: unknown, ctx: ExecutionContext) => {
    const request = ctx.switchToHttp().getRequest();
    return request.user;
  },
);
Source by docs.nestjs.com #
 
PREVIOUS NEXT
Tagged: #nest #js #decorator
ADD COMMENT
Topic
Name
2+5 =