ToolJet/server/src/controllers/app.controller.ts

20 lines
500 B
TypeScript
Raw Normal View History

2021-07-08 07:39:07 +00:00
import { Controller, Get, Request, Post, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '../modules/auth/jwt-auth.guard';
import { AuthService } from '../services/auth.service';
2021-07-08 05:40:27 +00:00
@Controller()
export class AppController {
2021-07-08 07:39:07 +00:00
constructor(private authService: AuthService) {}
2021-07-08 05:40:27 +00:00
2021-07-09 10:52:03 +00:00
@Post('authenticate')
2021-07-08 07:39:07 +00:00
async login(@Request() req) {
return this.authService.login(req.body);
}
@UseGuards(JwtAuthGuard)
@Get('profile')
getProfile(@Request() req) {
return req.body;
2021-07-08 05:40:27 +00:00
}
}