/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
integration/scopes/src/hello/hello.controller.ts
30 строк
765 B
Kamil Myśliwiec
feature() transient/request scope with circular deps
24 дек 2018, 16:45
Не верифицирован
24 дек 2018, 16:45
06dec9a
Код
Авторство
О чём код?
import { Controller, Get, Param, UseGuards, UseInterceptors, } from '@nestjs/common'; import { Guard } from './guards/request-scoped.guard'; import { HelloService } from './hello.service'; import { Interceptor } from './interceptors/logging.interceptor'; import { UserByIdPipe } from './users/user-by-id.pipe'; import { UsersService } from './users/users.service'; @Controller('hello') export class HelloController { static COUNTER = 0; constructor( private readonly helloService: HelloService, private readonly usersService: UsersService, ) { HelloController.COUNTER++; } @UseGuards(Guard) @UseInterceptors(Interceptor) @Get() greeting(@Param('id', UserByIdPipe) id): string { return this.helloService.greeting(); } }