using JWTdemo.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using JWTdemo.Models;
using JWTdemo.Authorization;
namespace JWTdemo.Controllers
{
[Authorize] //有token才能使用class
[Route("api/[controller]")]
[ApiController]
public class UserController : ControllerBase
{
private readonly SqlContext _context;
public UserController(SqlContext context)
{
_context = context;
}
///
/// 測試註解
///
[HttpGet]
public async Task>> Getuser()
{
return await _context.chatuser.ToListAsync();
}
}
}