Path: redb-route/redb.Route.Http/Rest/RestRouteBuilderExtensions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Http/Rest/RestRouteBuilderExtensions.cs
----
using redb.Route.Core;
namespace redb.Route.Http.Rest;
/// Entry point of the REST DSL: this.Rest("/api/orders", o => o.Port = 8080) inside a .
public static class RestRouteBuilderExtensions
{
///
/// Starts a REST declaration under . Each verb finished with To(...)
/// or Route() becomes an HTTP route on the shared Kestrel host; an OpenAPI document is served
/// at (default {basePath}/openapi.json).
///
public static RestDefinition Rest(this RouteBuilder builder, string basePath, Action? configure = null)
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentException.ThrowIfNullOrWhiteSpace(basePath);
var options = new RestOptions();
configure?.Invoke(options);
return new RestDefinition(builder, basePath, options);
}
}