Dogodek
Power BI DataViz Svetovno prvenstvo
14. feb., 16h - 31. mar., 16h
S 4 možnosti za vstop, bi lahko zmagal konferenčni paket in da bi bilo v ŽIVO Grand Finale v Las Vegasu
Več informacijTa brskalnik ni več podprt.
Izvedite nadgradnjo na Microsoft Edge, če želite izkoristiti vse prednosti najnovejših funkcij, varnostnih posodobitev in tehnične podpore.
Opomba
This isn't the latest version of this article. For the current release, see the .NET 9 version of this article.
Opozorilo
This version of ASP.NET Core is no longer supported. For more information, see the .NET and .NET Core Support Policy. For the current release, see the .NET 9 version of this article.
Pomembno
This information relates to a pre-release product that may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
For the current release, see the .NET 9 version of this article.
Minimal APIs are a simplified approach for building fast HTTP APIs with ASP.NET Core.
You can build fully functioning REST endpoints with minimal code and configuration. Skip traditional scaffolding and avoid unnecessary controllers by fluently declaring API routes and actions. For example, the following code creates an API at the root of the web app that returns the text, "Hello World!"
.
var app = WebApplication.Create(args);
app.MapGet("/", () => "Hello World!");
app.Run();
Most APIs accept parameters as part of the route.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/users/{userId}/books/{bookId}",
(int userId, int bookId) => $"The user id is {userId} and book id is {bookId}");
app.Run();
That's all it takes to get started, but it's not all that's available. Minimal APIs support the configuration and customization needed to scale to multiple APIs, handle complex routes, apply authorization rules, and control the content of API responses. A good place to get started is Tutorial: Create a minimal API with ASP.NET Core.
For a full list of common scenarios with code examples, see Minimal APIs quick reference.
Build a minimal API app with our tutorial: Tutorial: Create a minimal API with ASP.NET Core.
Povratne informacije o izdelku ASP.NET Core
ASP.NET Core je odprtokodni projekt. Izberite povezavo za pošiljanje povratnih informacij:
Dogodek
Power BI DataViz Svetovno prvenstvo
14. feb., 16h - 31. mar., 16h
S 4 možnosti za vstop, bi lahko zmagal konferenčni paket in da bi bilo v ŽIVO Grand Finale v Las Vegasu
Več informacijUsposabljanje
Modul
Build a web API with minimal API, ASP.NET Core, and .NET - Training
Learn how to build a web API by using .NET. You'll also learn how to set up different routes to handle both reading and writing.
Potrdilo
Microsoft Certified: Azure Developer Associate - Certifications
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.
Dokumentacija
Tutorial: Create a minimal API with ASP.NET Core
Learn how to build a minimal API with ASP.NET Core.
Learn about differences between controller-based APIs and minimal APIs.
Ask the Expert: Create a web API with ASP.NET Core
Interested in creating a web API? Learn more about building a RESTful service with ASP.NET Core that supports Create, Read, Update, Delete (CRUD) operations. Join Shayne Boyer, Jon Galloway, and Brady Gaster as they answer your questions. Chapters 00:00 - Introduction 03:15 - What do you need to create your first web API? 05:17 - What are some challenges to getting started with API development? 10:07 - What's a good next step after completing the Learn Module? 13:45 - Is there a pattern that I can use to s