Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddScoped<HeroesRepository, HeroesRepository>();
- #if DEBUG
- services.AddCors(options =>
- {
- options.AddPolicy(
- "AllowSpecificOrigin",
- builder => builder
- .AllowAnyOrigin()
- .AllowAnyHeader()
- .AllowAnyMethod()
- );
- });
- #endif
- services.AddMvc();
- }
- public void Configure(IApplicationBuilder app, IHostingEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
- else
- {
- app.UseExceptionHandler("/Home/Error");
- }
- #if DEBUG
- app.UseCors("AllowSpecificOrigin");
- #endif
- app.UseStaticFiles();
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- // Will make angular page bookmarkable
- routes.MapSpaFallbackRoute(
- name: "spa-fallback",
- defaults: new { controller = "Home", action = "Index" });
- });
- }
Add Comment
Please, Sign In to add comment