Created
April 4, 2019 02:37
-
-
Save sliceofbytes/743be8bcc4baad8d1a7f6b064b19dbd1 to your computer and use it in GitHub Desktop.
startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
else | |
{ | |
app.UseExceptionHandler("/Home/Error"); | |
app.UseHsts(); | |
} | |
app.UseHttpsRedirection(); | |
app.UseStaticFiles(); | |
app.UseSpaStaticFiles(); | |
app.UseAuthentication(); | |
app.UseSwagger(); | |
app.UseSwaggerUI(s => | |
{ | |
s.SwaggerEndpoint("/swagger/v1/swagger.json", "Some Stupid API v1"); | |
}); | |
app.UseMvc(routes => | |
{ | |
routes.MapRoute( | |
name: "default", | |
template: "{controller}/{action=Index}/{id?}"); | |
}); | |
app.UseCors("CorsPolicy"); | |
app.UseSignalR(routes => | |
{ | |
routes.MapHub<MyHub>("/hubs/myhub"); | |
}); | |
app.UseSpa(spa => | |
{ | |
spa.Options.SourcePath = "ClientApp"; | |
if (env.IsDevelopment()) | |
{ | |
spa.UseAngularCliServer(npmScript: "start"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment