using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using BH.API.Identity.Client.NetCore; using Signup.Billhighway.Com; using BH.Signup.Core.Services; using BH.API.Subscriptions.Client.NetCore; using BH.Signup.Core.Domain; using BH.Signup.Core.Repositories; namespace signup.billhighway.com { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); Configuration = builder.Build(); Console.WriteLine(nameof(env.EnvironmentName) + " " + env.EnvironmentName); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // Added - uses IOptions for your settings. services.AddOptions(); // Added - Confirms that we have a home for our DemoSettings services.Configure(Configuration.GetSection("IdentityProxySettings")); services.Configure(Configuration.GetSection("SubscriptionProxySettings")); services.Configure(Configuration.GetSection("DataConnectionSettings")); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = false }); } app.UseExceptionHandler("/Errors/Error"); app.UseStaticFiles(); app.UseMvc(routes => { // [GET] HOME-ROUTER ROUTES routes.MapRoute( name: "router-nat-and-group", template: "{NatMap}/group/{GroupMap}", defaults: new { action = "Router", controller = "Home" }); routes.MapRoute( name: "router-nat-and-group-and-user", template: "{NatMap}/group/{GroupMap}/{UserType}/user/{UserID}", defaults: new { action = "Router", controller = "Home" }); // [GET] HOME-INDEX ROUTES routes.MapRoute( name: "index-nat-and-group", template: "{NatMap}/group/{GroupMap}/form/{FormTemplateID}", defaults: new { action = "Index", controller = "Home" }); routes.MapRoute( name: "index-nat-and-group-and-user", template: "{NatMap}/group/{GroupMap}/{UserType}/user/{UserID}/form/{FormTemplateID}", defaults: new { action = "Index", controller = "Home" }); // ERROR Route routes.MapRoute( name: "error", template: "Errors/Error", defaults: new { action = "Error", controller = "Errors" }); }); } } }