ardalis / ApiEndpoints

A project for supporting API Endpoints in ASP.NET Core web applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add sample / improve docs when starting with an empty web api project

jtuchel opened this issue · comments

Related to #202

The "getting started" section explains how to implement a handler. And the samples show how to work with the library in larger projects. But I wasn't able to find any documentation for the following case:

  • Create an empty web api project
  • The generated Program.cs contains
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

// Remove the following minimal api line
// app.MapGet("/", () => "Hello World!");

app.Run();

At least I don't know what is required to register a handler. If you let me know I could work on a PR to improve the docs :)

To make it work I had to use this code

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();

var app = builder.Build();
app.MapControllers();
app.Run();

Should I add it to the docs? Or just close the issue?

Yes please!