A query parameter supplies an option after the path of a request URL. In an ASP.NET Core minimal API, a handler can receive that value without naming it in the route. For example, `/{text}` supplies `text` from the path, while `?font=DotMatrix` supplies `font` from the query string. section 3.1
Listing 3.7 Rendering with custom font from optional query string
using AsciiArtSvc; #1
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.MapGet("/{text}", #2
(string text, string? font) => #3
AsciiArt.Write(text, font)); #4
app.Run();
The route contains `{text}` but not `font`. The handler accepts `string? font` and passes it to the rendering method; the nullable type makes the query parameter optional. section 3.1
The parameter name matters: `MapGet` looks for a matching name in the route before using the query string. Use a nullable handler type when a value may be omitted. Changing `string? font` to `string font` makes a request without `font` fail. A value that cannot be converted to the handler’s specified type also makes the request fail. section 3.1
Query parameters can also shape a collection response. An endpoint listing available fonts uses `skip` and `take` for paging, with defaults when either nullable integer is absent. Further optional parameters filter by name or text direction and select a sort order. section 3.1.1
Listing 3.12 Adding skip parameter to all-fonts query
app.MapGet("/",
(int? skip, int? take) => #1
AsciiArt.AllFonts.Value
.Skip(skip ?? 0) #2
.Take(take ?? 100)); #3
The handler accepts `int? skip` and `int? take`, then applies `Skip(skip ?? 0)` and `Take(take ?? 100)`. The defaults keep requests without either parameter usable. section 3.1.1






























