MapGet associates a route with a handler in an ASP.NET Core web service. A root mapping such as app.MapGet("/", () => "Hello World!") returns the handler’s string response. section 3.1
A parameterized mapping adds request data to the handler:
- The route "/{text}" captures the URL segment after the root. section 3.1
- A handler parameter named text receives the captured value as a string. section 3.1
- Route values are converted to the declared type; conversion failures or name mismatches fail the request. section 3.1
Listing 3.5 Program.cs with ASCII art request handling
using Figgle; #1
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.MapGet("/{text}", #2
(string text) => #3
FiggleFonts.Standard.Render(text)); #4
app.Run();
View the focused Program.cs example that maps both the root route and an ASCII-art route. section 3.1


