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

Popular posts from this blog

What are different steps used in JDBC? Write down a small program showing all steps.

Discuss classification or taxonomy of virtualization at different levels.

Pure Versus Partial EC