完成jwt鉴权
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
import { Controller, Get, Injectable, UseGuards } from '@nestjs/common';
|
||||
import { UserService } from './user.service';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Controller('user')
|
||||
export class UserController {}
|
||||
export class UserController {
|
||||
|
||||
constructor(
|
||||
private readonly userService: UserService
|
||||
) { }
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get('me')
|
||||
async getMe() {
|
||||
return 'ok';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user