Refactor code structure for improved readability and maintainability
This commit is contained in:
20
src/api/api.controller.ts
Normal file
20
src/api/api.controller.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Body, Controller, Delete, Inject, Post } from "@nestjs/common";
|
||||
import { ApiService } from "./api.service";
|
||||
|
||||
@Controller("api")
|
||||
export class ApiController {
|
||||
constructor(
|
||||
@Inject(ApiService)
|
||||
private readonly apiService: ApiService
|
||||
) {}
|
||||
|
||||
@Post("token/generate")
|
||||
generateToken(@Body() body: { token: string }) {
|
||||
return this.apiService.generateToken(body.token);
|
||||
}
|
||||
|
||||
@Delete("token/revoke")
|
||||
revokeToken(@Body() body: { token: string }) {
|
||||
return this.apiService.revokeToken(body.token);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user