Skip to content

Instantly share code, notes, and snippets.

@crgrieve
Created January 10, 2021 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crgrieve/fad0d6c532d7096338fe7d047db99572 to your computer and use it in GitHub Desktop.
Save crgrieve/fad0d6c532d7096338fe7d047db99572 to your computer and use it in GitHub Desktop.
.Net 5 example WebAPI controller
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CaroleExampleApp.Controllers
{
[ApiController]
[Route("[controller]")]
public class BlogController : ControllerBase
{
private readonly ILogger<BlogController> _logger;
public BlogController(ILogger<BlogController> logger)
{
_logger = logger;
}
[HttpGet]
public string Get()
{
return ".Net 5: WebAPI with OpenAPI docs";
}
[HttpPost]
public bool SendBlog(String text)
{
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment