You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.3 KiB
C#
64 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace HttpClientStudy.WebApp.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 简单接口 控制器
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class HelloController : ControllerBase
|
|
{
|
|
private ILogger<HelloController > _logger;
|
|
|
|
/// <summary>
|
|
/// 构造
|
|
/// </summary>
|
|
public HelloController (ILogger<HelloController > logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ping
|
|
/// </summary>
|
|
/// <returns>Pong</returns>
|
|
[HttpGet]
|
|
public IActionResult Ping()
|
|
{
|
|
return Ok("Pong");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Index
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IActionResult Index()
|
|
{
|
|
return Ok("Index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get请求
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IActionResult Get()
|
|
{
|
|
return Ok("Hello, world!");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Post 请求
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public IActionResult Post()
|
|
{
|
|
return Ok("Hello, world!");
|
|
}
|
|
}
|
|
}
|