Genesis Game Server Project Setup

This commit is contained in:
2026-03-13 12:37:59 +09:00
commit af40aa2b45
17 changed files with 595 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using GameServer.Data; // DbContext가 있는 폴더
using GameServer.Models; // Model이 있는 폴더
namespace GameServer.Controllers
{
[ApiController]
[Route("myGame")] // 접속 주소: /myGame
public class CharacterController : ControllerBase
{
private readonly AppDbContext _context;
// DB 연결 도구(Context)를 가져옵니다.
public CharacterController(AppDbContext context)
{
_context = context;
}
// 플레이어블 캐릭터 목록
[HttpGet("playableCharacters")]
public async Task<IActionResult> GetPlayableCharacters()
{
List<CharacterModel> list = await _context.Characters
.Where(x => x.CharacterType == "PLAYABLE")
.ToListAsync();
return Ok(new ApiResponse<List<CharacterModel>>
{
Data = list,
Count = list.Count
});
}
}
}