From 45b54f1f4cfdd4ae76cffab1f7468c6c605e65be Mon Sep 17 00:00:00 2001 From: HyeonMin Shin Date: Wed, 6 Sep 2023 16:33:21 +0900 Subject: [PATCH] feat: auth public setup --- src/app.controller.ts | 2 +- src/auth/auth.controller.ts | 7 +++++-- src/main.ts | 1 + src/post/post.controller.ts | 2 +- src/user/user.controller.ts | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app.controller.ts b/src/app.controller.ts index bd1fa59..0bf33c7 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common' import { AppService } from './app.service' import { Public } from './auth/auth.decorator' -@Controller('shinmini-homepage/us-central1/api') +@Controller('shinmini-homepage/us-central1/api/') export class AppController { constructor(private readonly appService: AppService) {} diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 53660b5..4070667 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -10,25 +10,28 @@ import { } from '@nestjs/common' import { AuthService } from './auth.service' import { AuthGuard } from './auth.guard' +import { Public } from './auth.decorator' -@Controller('auth') +@Controller('shinmini-homepage/us-central1/api/auth') export class AuthController { constructor(private readonly authService: AuthService) {} @HttpCode(HttpStatus.OK) + @Public() @Post('login') signIn(@Body() signInDto: { email: string; password: string }) { return this.authService.signIn(signInDto) } @HttpCode(HttpStatus.CREATED) + @Public() @Post('signup') signUp(@Body() signUpDto: { email: string; password: string }) { return this.authService.signUp(signUpDto) } @UseGuards(AuthGuard) - @Get('Profile') + @Get('profile') getProfile(@Request() req: any) { return req.user } diff --git a/src/main.ts b/src/main.ts index 2e1dab5..ae47600 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,7 @@ async function bootstrap() { credentials: true, }, }) + await app.listen(process.env.PORT || 3000) } bootstrap().then(() => diff --git a/src/post/post.controller.ts b/src/post/post.controller.ts index 84c9b0a..fa1453a 100644 --- a/src/post/post.controller.ts +++ b/src/post/post.controller.ts @@ -2,7 +2,7 @@ import { Controller, Get, Post, Body, Param, Delete, Put } from '@nestjs/common' import { PostService } from './post.service' import { Post as PostModel, Prisma } from '@prisma/client' -@Controller('post') +@Controller('shinmini-homepage/us-central1/api/post') export class PostController { constructor(private readonly postService: PostService) {} diff --git a/src/user/user.controller.ts b/src/user/user.controller.ts index 94688e5..1f1ec99 100644 --- a/src/user/user.controller.ts +++ b/src/user/user.controller.ts @@ -2,7 +2,7 @@ import { Controller, Post, Body } from '@nestjs/common' import { UserService } from './user.service' import { User as UserModel } from '@prisma/client' -@Controller('user') +@Controller('shinmini-homepage/us-central1/api/user') export class UserController { constructor(private readonly userService: UserService) {}