parent
3c216fa12a
commit
69c0a65ad5
2 changed files with 36 additions and 48 deletions
@ -1,21 +1,20 @@ |
||||
import { Controller, Post, Body, Res, UseGuards, Get } from "@nestjs/common"; |
||||
import { UsersService } from "./users.service"; |
||||
import { Response } from "express"; |
||||
import { JwtAuthGuard } from "src/guard/auth.guard"; |
||||
import { User } from "./entities/user.entity"; |
||||
|
||||
@Controller("users") |
||||
@Controller("user") |
||||
export class UsersController { |
||||
constructor(private readonly usersService: UsersService) {} |
||||
|
||||
@Post("register") |
||||
async register(@Body() body: { email: string; password: string }, @Res() res: Response): Promise<Response> { |
||||
async register(@Body() body: { email: string; password: string }):Promise<User> { |
||||
const { email, password } = body; |
||||
return this.usersService.register(email, password, res); |
||||
return this.usersService.register(email, password); |
||||
} |
||||
|
||||
@Post("login") |
||||
async login(@Body() body: { email: string; password: string }, @Res() res: Response): Promise<Response> { |
||||
async login(@Body() body: { email: string; password: string }):Promise<{token}> { |
||||
const { email, password } = body; |
||||
return this.usersService.login(email, password, res); |
||||
return this.usersService.login(email, password); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue