Created
January 10, 2021 14:54
-
-
Save crgrieve/fad0d6c532d7096338fe7d047db99572 to your computer and use it in GitHub Desktop.
.Net 5 example WebAPI controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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