Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add prefix #18

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/app.controller.spec.ts

This file was deleted.

13 changes: 6 additions & 7 deletions src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { Controller, Get } from '@nestjs/common';

import { AppService } from './app.service';
import { UseAuthGuard } from './common/decorators/auth-guard.decorator';
import { CurrentUser } from './common/decorators/user.decorator';
import { User } from './user/entities/user.entity';
import { UserRole } from './user/entities/user.type';

@Controller()
@Controller('api/v1')
export class AppController {
constructor(private readonly appService: AppService) {}
constructor() {}

@Get()
getHello(): string {
return this.appService.getHello();
@Get('health')
health(): string {
return 'ok';
}

@Get('/me')
@Get('me')
@UseAuthGuard([UserRole.USER])
getMe(@CurrentUser() user: User): User {
return user;
Expand Down
2 changes: 0 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ConfigModule } from '@nestjs/config';
import { MikroOrmModule } from '@mikro-orm/nestjs';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { getNodeEnv, isIgnoreEnvFile } from './common/helper/env.helper';
import { envValidation } from './common/helper/env.validation';
Expand All @@ -28,6 +27,5 @@ import { UserModule } from './user/user.module';
UserMapModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
8 changes: 0 additions & 8 deletions src/app.service.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { UserProvider } from 'src/user/entities/user.type';
import { AuthService } from './auth.service';

@ApiTags('auth')
@Controller('auth')
@Controller('api/v1/auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}

Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ async function bootstrap() {
.build();

const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api-docs', app, document);
SwaggerModule.setup('api/docs', app, document);

const configService = app.select(AppModule).get(ConfigService);
const port = configService.get('PORT');
await app.listen(port);
console.log(`Application is running: http://localhost:${port}/api-docs`);
console.log(`Application is running: http://localhost:${port}/api/docs`);
}
bootstrap();
2 changes: 1 addition & 1 deletion src/map/map.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { UpdateMapDto } from './dtos/update-map.dto';
import { MapService } from './map.service';

@ApiTags('maps')
@Controller('maps')
@Controller('api/v1/maps')
export class MapController {
constructor(private readonly mapService: MapService) {}

Expand Down
2 changes: 1 addition & 1 deletion src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { UserResponseDto } from './dtos/user-response.dto';
import { UserService } from './user.service';

@ApiTags('users')
@Controller('users')
@Controller('api/v1/users')
export class UserController {
constructor(private readonly userService: UserService) {}

Expand Down
Loading