mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
30 lines
1004 B
C#
30 lines
1004 B
C#
using Hub.Service.Hubs;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Hub.Service
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
|
|
|
services.AddSignalR().AddJsonProtocol(options => { options.PayloadSerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); });
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder applicationBuilder, IHostingEnvironment environment)
|
|
{
|
|
if (environment.IsDevelopment())
|
|
{
|
|
applicationBuilder.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
applicationBuilder.UseSignalR(routes => { routes.MapHub<WeatherHub>("/weatherHub"); });
|
|
|
|
applicationBuilder.UseMvc();
|
|
}
|
|
}
|
|
} |