nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

Console output doesn't show for which URL controllers are mapped for. #153

Closed cojack closed 7 years ago

cojack commented 7 years ago
╭─cojack@cojack-desktop  ~/Projects/private/nest/examples/01-cats-app  ‹master*› 
╰─$ npm start

> nest-typescript-starter@1.0.0 start /home/cojack/Projects/private/nest/examples/01-cats-app
> node index.js

[Nest] 28918   - 9/14/2017, 11:10:29 AM   [NestFactory] Starting Nest application...
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [InstanceLoader] ApplicationModule dependencies initialized
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [InstanceLoader] CatsModule dependencies initialized
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [RoutesResolver] CatsController:  <- HERE
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [RouterExplorer] Mapped {/, POST} route
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [RouterExplorer] Mapped {/, GET} route
[Nest] 28918   - 9/14/2017, 11:10:29 AM   [NestApplication] Nest application successfully started

Output from console doesn't show for which URL controllers are mapped for.

╭─cojack@cojack-desktop  ~/Projects/private/nest/examples/01-cats-app  ‹master*› 
╰─$ cat src/modules/cats/cats.controller.ts 
import { Controller, Get, Post, Body, UseGuards, ReflectMetadata, UseInterceptors } from '@nestjs/common';
import { CreateCatDto } from './dto/create-cat.dto';
import { CatsService } from './cats.service';
import { Cat } from './interfaces/cat.interface';
import { RolesGuard } from '../common/guards/roles.guard';
import { Roles } from '../common/decorators/roles.decorator';
import { LoggingInterceptor } from '../common/interceptors/logging.interceptor';
import { TransformInterceptor } from '../common/interceptors/transform.interceptor';

@Controller('cats')
@UseGuards(RolesGuard)
@UseInterceptors(LoggingInterceptor, TransformInterceptor)
export class CatsController {
  constructor(private readonly catsService: CatsService) {}

  @Post()
  @Roles('admin')
  async create(@Body() createCatDto: CreateCatDto) {
    this.catsService.create(createCatDto);
  }

  @Get()
  async findAll(): Promise<Cat[]> {
    return this.catsService.findAll();
  }
}

So I guess this line: [Nest] 28918 - 9/14/2017, 11:10:29 AM [RoutesResolver] CatsController: <- HERE Should display something like: [Nest] 28918 - 9/14/2017, 11:10:29 AM [RoutesResolver] CatsController: cats

JulianBiermann commented 7 years ago

I'd also like to see this information in the output.

If your setting a global prefix maybe include it too.

Expected output: [Nest] 28918 - 9/14/2017, 11:10:29 AM [RoutesResolver] CatsController: /api/cats

kamilmysliwiec commented 7 years ago

Hi @cojack, Honestly, I never thought about it. It's not a bug :slightly_smiling_face:

cojack commented 7 years ago

@kamilmysliwiec I was pretty sure, that in v2 it works like this :smiling_imp:

xujif commented 7 years ago

+1 need it.

kamilmysliwiec commented 7 years ago

Done (v4.2.0) 🌮

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.