Spaces:
Runtime error
Runtime error
Download backend/src/modules/auth/auth.controller.ts from Denisijcu/medicodeapp: direct link, hf CLI and curl.
- Browser
- Download file 939 Bytes
-
https://huggingface.co/spaces/Denisijcu/medicodeapp/resolve/main/backend/src/modules/auth/auth.controller.ts
- Command line
-
hf download hf://spaces/Denisijcu/medicodeapp/backend/src/modules/auth/auth.controller.ts
-
curl -L -o auth.controller.ts https://huggingface.co/spaces/Denisijcu/medicodeapp/resolve/main/backend/src/modules/auth/auth.controller.ts
939 Bytes
| import { Controller, Post, Body, Get, UseGuards, Request } from '@nestjs/common'; | |
| import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; | |
| import { AuthGuard } from '@nestjs/passport'; | |
| import { AuthService } from './auth.service'; | |
| import { RegisterDto } from './dto/register.dto'; | |
| import { LoginDto } from './dto/login.dto'; | |
| ('Auth') | |
| ('auth') | |
| export class AuthController { | |
| constructor(private authService: AuthService) {} | |
| ('register') | |
| ({ summary: 'Register a new user' }) | |
| register(() dto: RegisterDto) { | |
| return this.authService.register(dto); | |
| } | |
| ('login') | |
| ({ summary: 'Login and get JWT' }) | |
| login(() dto: LoginDto) { | |
| return this.authService.login(dto); | |
| } | |
| ('me') | |
| () | |
| (AuthGuard('jwt')) | |
| ({ summary: 'Get current user profile' }) | |
| me(() req: any) { | |
| return req.user; | |
| } | |
| } | |