/DotNet6_MinimalAPI

DotNet 6 Minimal API

Primary LanguageC#

DotNet 6 Minimal API

First look at the Minimal API repository.

What is Minimal API

It is a fresh new approach to building APIs without all the complex structure of MVC, it could seems like a prototyping tool for some but for other it could look like a stepping stone into the world of APIs.

Minimal simply means that it contains the essential components needed to build HTTP APIs. Basically with minimal API all you need is a csproj and a program.cs to get started

Minimal API uses the power of C# 9 and .NET 6.0 it combines Top Level statement and Lambda Attributes of C# and abstracting alot of the pipeline and configuration of MVC

Benefit of Minimal API

  1. Reduce complexity
  2. Reduce ceremony for all developers
  3. Easy to get started: all you need is the Program.cs and your csproj and 3 lines of code to create your first API
  4. Its powered by .Net 6 and C# 10 so all of the latest improvements and functionalities are supported out of the box
  5. API without controllers
  6. Performance: since the application is so simple alot og bootstrapping that is required to build and compile the application is simplified which means the application runs much faster

Swagger image is as below :

Screenshot_6

useful links :

  1. https://docs.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-6.0&tabs=visual-studio
  2. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-6.0