| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Microsoft.AspNetCore.Server.Kestrel.Core;
- using ProtoBuf.Grpc.Server;
- using SpotifyService.Services;
-
-
- var builder = WebApplication.CreateBuilder(args);
-
- #if DEBUG
- /*
- builder.WebHost.ConfigureKestrel(options =>
- {
- options.ListenLocalhost(5050, o => o.Protocols =
- HttpProtocols.Http2);
- options.ListenLocalhost(5051, o => o.Protocols =
- HttpProtocols.Http1AndHttp2);
- });
- */
- #endif
-
- // Add services to the container.
-
- builder.Services.AddHttpClient("HttpClient", c =>
- {
- c.BaseAddress = new Uri(SpotifyService.GLOBALS.SPOTIFYURL);
- c.DefaultRequestHeaders.Add("Accept", SpotifyService.GLOBALS.MEDIATYPE);
- });
-
- builder.Services.AddControllersWithViews();
- builder.Services.AddRazorPages();
-
- builder.Services.AddEndpointsApiExplorer();
- builder.Services.AddSwaggerGen();
-
- builder.Services.AddGrpc();
- builder.Services.AddCodeFirstGrpc();
- builder.Services.AddCodeFirstGrpcReflection();
-
- var app = builder.Build();
-
- app.UseSwagger();
- app.UseSwaggerUI();
-
- // Configure the HTTP request pipeline.
- if (app.Environment.IsDevelopment())
- {
- app.UseWebAssemblyDebugging();
- }
- else
- {
- app.UseExceptionHandler("/Error");
- // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
- app.UseHsts();
- }
-
- app.UseHttpsRedirection();
-
- app.UseBlazorFrameworkFiles();
- app.UseStaticFiles();
-
- app.UseRouting();
-
- app.UseGrpcWeb();
-
- app.MapRazorPages();
- app.MapControllers();
-
- //app.MapGrpcService<WeatherService>();
- //app.MapGrpcService<SearchService>().EnableGrpcWeb();
-
- app.MapCodeFirstGrpcReflectionService();
-
- app.MapFallbackToFile("index.html");
-
- app.Run();
|