Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jtuchel opened this issue Dec 29, 2023 · 2 comments
Open

Comments

@jtuchel
Copy link

jtuchel commented Dec 29, 2023

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 :)

@jtuchel
Copy link
Author

jtuchel commented Dec 30, 2023

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?

@ardalis
Copy link
Owner

ardalis commented Jan 15, 2024

Yes please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants