Minimal APIs
Build minimal APIs with C#
Minimalism First 🍃
Rapidly move from idea to a functioning application. All the features of C# web applications without the ceremony.
Grows With You 🌱
As your web application grows, so do we! The C# ecosystem powers the most productive applications on the web.
Incredibly Fast ⚡
Proven to be one of the fastest web servers in the world, serving more than 4 million requests per second.
# Great for Microservices
Minimal APIs are great for building microservices for your applications fast.
# C# Ecosystem
Minimal APIs is built using C#. An open-source, modern, object-oriented, and type-safe programming language you'll love. Build an API in C# with just 3 lines of code.
var app = WebApplication.Create(args);
app.MapGet("/", () => "Hello World!");
app.Run();
2
3
4
5
# Routing
Minimal routes by design. Create meaningful low ceremony URLs that execute your code.
app.MapGet("/", () => "Hello World!");
# Feels familiar
Minimal code patterns have been popular in JavaScript and Python web frameworks for a while. Whether you are familiar with Express or Flask, we think you can easily do things you enjoy about those frameworks with minimal APIs as well.
For example
Routes in Express
// GET method route
app.get('/', function (req, res) {
res.send('GET request to the homepage')
})
// POST method route
app.post('/', function (req, res) {
res.send('POST request to the homepage')
})
2
3
4
5
6
7
8
9
Routes in minimal APIs
app.MapGet("/", () => "GET request to the homepage");
app.MapPost("/", () => "POST request to the homepage");
2