Files
Warhound/WarhoundConsole/Test.cs
2025-10-15 02:27:39 +09:00

41 lines
983 B
C#

using Microsoft.AspNetCore.Mvc;
namespace WarhoundConsole
{
[ApiController]
[Route("api/test")]
public class Test : ControllerBase
{
[HttpGet("hello")]
public ActionResult<string> GetGreeting()
{
string message = "Hello!!!";
if (message.Length != 0)
{
//throw new Exception("Hello");
}
return Ok(message);
}
[HttpGet("data")]
public ActionResult<object> GetData()
{
var data = new { Id = 1, Name = "Sample Data", Timestamp = DateTime.UtcNow };
return Ok(data);
}
[HttpPost("json")]
public ActionResult<object> asd([FromBody] object obj)
{
//if (obj == null)
//{
// return BadRequest("Invalid data.");
//}
Console.Write(obj.ToString());
return Ok(new { a = 1, b = 2, c = "c" });
}
}
}