35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using ServerSideBlazor.Client;
|
|
|
|
namespace ServerSideBlazor.Server
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
// Adds the Server-Side Blazor services, and those registered by the client startup.
|
|
services.AddServerSideBlazor<Client.Startup>();
|
|
|
|
// Since Blazor is running on the server, we can use an application service
|
|
// to read the forecast data.
|
|
services.AddSingleton<WeatherForecastService, DefaultWeatherForecastService>();
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
// Use component registrations and static files from the client startup.
|
|
app.UseServerSideBlazor<Client.Startup>();
|
|
}
|
|
}
|
|
}
|