完成jwt鉴权

This commit is contained in:
2025-05-07 14:34:49 +08:00
parent d2744689b2
commit 1246613fb1
9 changed files with 139 additions and 17 deletions

View File

@@ -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';
}
}