using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using spanreed.Shared; using spanreed.Server.Data; namespace spanreed.Server.Controllers { [ApiController] [Route("[controller]")] public class ChatController : ControllerBase { private readonly PrevChat prevChat; public ChatController(PrevChat chatArchive) { this.prevChat = chatArchive; } [HttpGet("{room}")] public IEnumerable Get([FromRoute] string room) { if (prevChat.Chats.ContainsKey(room)) { return prevChat.Chats[room]; } return new ChatData[0]; } } }