How to create Web API in ASP.NET Core.
Create a controller that has 3 things:
- It should have the [ApiController] attribute on them. This attribute tells that the controller will serve HTTP API Responses.
- Derive from ControllerBase class instead of Controller class.
- It should have attribute routing applied on them like [Route("someUrl/[controller]")].
- The controller of a Web API looks like this:-
Comments
Post a Comment