Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Web / PUSG.Web / Startup.cs
diff options
context:
space:
mode:
Commit6fb05a2a6f94e008dc689291d0522f39f87a6622 (patch)
Author
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-01-24 14:45:23 +0200
Committer
 ivaylo.zhelev <ivaylo.zhelev@solarwinds.com>
2021-01-24 14:45:23 +0200
Files845087b1419336f526b68678d92d090c1076a132 /src/Web/PUSG.Web/Startup.cs
pusg-api-6fb05a2a6f94e008dc689291d0522f39f87a6622.tar
pusg-api-6fb05a2a6f94e008dc689291d0522f39f87a6622.tar.gz
pusg-api-6fb05a2a6f94e008dc689291d0522f39f87a6622.zip
Parentd62fcf4e8af0705756bcf159588c0e5eeab1a56d (diff)
Initial Commit - Add all project files
1 files changed, 62 insertions, 0 deletions
-rw-r--r--src/Web/PUSG.Web/Startup.cs62
diff --git a/src/Web/PUSG.Web/Startup.cs b/src/Web/PUSG.Web/Startup.cs
new file mode 100644
index 0000000..82ae7e4
--- /dev/null
+++ b/src/Web/PUSG.Web/Startup.cs
@@ -0,0 +1,62 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using PUSG.Web.Hubs;
+using PUSG.Web.Static;
+
+namespace PUSG.Web
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ // This method gets called by the runtime. Use this method to add services to the container.
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddSingleton<ISessionService, SessionService>();
+
+ services.AddControllers();
+ services.AddSignalR();
+
+ services.AddCors(options =>
+ {
+ options.AddPolicy("CustomPolicy", builder =>
+ {
+ builder
+ .WithOrigins("http://localhost:8001")
+ .AllowCredentials()
+ .AllowAnyHeader()
+ .AllowAnyMethod();
+ });
+ });
+ }
+
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+
+ app.UseHttpsRedirection();
+
+ app.UseCors("CustomPolicy");
+
+ app.UseRouting();
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapHub<HomeHub>("/home");
+ endpoints.MapControllers();
+ });
+ }
+ }
+}