Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dummy RESTful API
using System.Net;
using Microsoft.AspNetCore.Mvc;
namespace WebApplication4.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
[HttpGet]
public IActionResult Get()
{
return Ok("get");
}
[HttpPost]
public IActionResult Post()
{
return Created("https://ignas.me", string.Empty);
}
[HttpPut]
public IActionResult Put()
{
return Ok("put");
}
[HttpDelete]
public IActionResult Delete()
{
return StatusCode((int)HttpStatusCode.NoContent);
}
}
}
// https://ignas.me/tech/405-method-not-allowed-iis/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment