Skip to content

NikiforovAll/minimal-api-example

Repository files navigation

Modular Minimal API in .NET 6

Todo application that shows you how to apply Modular Minimal API recommendations.

var builder = WebApplication.CreateBuilder(args);

builder.AddSerilog();
builder.AddSwagger();
builder.AddAuthentication();
builder.AddAuthorization();
builder.Services.AddCors();
builder.AddStorage();

builder.Services.AddCarter();

var app = builder.Build();
var environment = app.Environment;

app
    .UseExceptionHandling(environment)
    .UseSwaggerEndpoints(routePrefix: string.Empty)
    .UseAppCors()
    .UseAuthentication()
    .UseAuthorization();

app.MapCarter();

app.Run();
$ tree ./Features
.
├── HomeModule.cs
└── TodosModule.cs
POST {{h}}/todos
Content-Type: application/json

{
  "title": "Write blog post about minimal api"
}


GET {{h}}/todos


PUT {{h}}/todos/4/mark-complete

Build and Run

Clone the repository and enter dotnet run.

Demo

Please see assets/run.http for more details.

alt

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy