Skip to content

Commit

Permalink
feat: auth public setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinMini committed Sep 6, 2023
1 parent aa94ba4 commit 45b54f1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down
7 changes: 5 additions & 2 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function bootstrap() {
credentials: true,
},
})

await app.listen(process.env.PORT || 3000)
}
bootstrap().then(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/post/post.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

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 @@ -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) {}

Expand Down

0 comments on commit 45b54f1

Please sign in to comment.