HTTP Server
Baked uses ASP.NET Core's WebApplication
to build and host a web application.
app.Layers.AddHttpServer();
Configuration Targets
HttpServer
layer provides IAuthenticationCollection
,
IMiddlewareCollection
and IEndpointRouteBuilder
targets to configure a web
application.
IAuthenticationCollection
This target is provided in AddServices
phase. To configure it in a feature;
configurator.ConfigureAuthenticationCollection(authentications =>
{
...
});
IMiddlewareCollection
This target is provided in Build
phase as the first target. To configure it in
a feature;
configurator.ConfigureMiddlewareCollection(middlewares =>
{
...
});
IEndpointRouteBuilder
This target is provided in Build
phase right after IMiddlewareCollection
. To
configure it in a feature;
configurator.ConfigureEndpointRouteBuilder(routes =>
{
...
});
Phases
This layer introduces following phases to the application it is added;
CreateBuilder
: This phase is the earliest phase in an application which creates and adds aWebApplicationBuilder
instance to the application context along with aConfigurationManager
instanceBuild
: This phase adds all services from dependency injection layer to the services inWebApplicationBuilder
instance, then builds the app and addsWebApplication
andIServiceProvider
instances to the application contextRun
: This phase is added to the application internally as the latest phase to run theWebApplication