Skip to content
AgileLogics
5 min read

Building a Web API with ASP.NET Core

Prerequisites: Memory management & garbage collection

ASP.NET Core is the dominant framework for C# backend services — directly comparable to Java's Spring Boot:

[ApiController]
[Route("api/[controller]")]
class UsersController : ControllerBase {
    [HttpGet("{id}")]
    public User GetUser(int id) {
        return new User(id, "Ada");
    }

    [HttpPost]
    public User CreateUser([FromBody] User user) {
        // save user...
        return user;
    }
}

[ApiController] and [Route] mark the class as handling HTTP requests; [HttpGet]/[HttpPost] map a method to an HTTP verb and path; [FromBody] automatically deserializes an incoming JSON body — the same reflection-and-attributes mechanism from earlier in this level.