// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory) { loggerFactory.AddDebug(LogLevel.Warning); //app.UseDefaultFiles(); app.UseStaticFiles();//Se queda por los css, js, etc. app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); //config.CreateMap<TripViewModel, Trip>(); <-- ReverseMap() config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); await seeder.EnsureSeedDataAsync(); //app.Run(async (context) => //{ // await context.Response.WriteAsync($"Hello World: {context.Request.Path}"); //}); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory, IHostingEnvironment env) { if (env.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); } else { loggerFactory.AddDebug(LogLevel.Error); app.UseExceptionHandler("/App/Error"); } app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seedData, ILoggerFactory loggerFactory, IHostingEnvironment env) { if (env.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); } else { loggerFactory.AddDebug(LogLevel.Error); app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(ConfigureRouteDefaults); await seedData.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { //loggerFactory.AddConsole(); loggerFactory.AddDebug(LogLevel.Warning); //if (env.IsDevelopment()) if (env.IsEnvironment("Development")) { app.UseDeveloperExceptionPage(); } //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); // This is to serve html,css, js from wwwwroot folder //app.UseDefaultFiles(); app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap <Trip, TripViewModel>().ReverseMap(); config.CreateMap <Stop, StopViewModel>().ReverseMap(); }); // Setting up MVC with a route app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); } ); // This is seeding the database await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WorldContextSeedData seeder) { app.UseIISPlatformHandler(); app.UseDeveloperExceptionPage(); //app.UseGlobalExceptionHandler(); app.UseIdentity(); //loggerFactory.AddConsole(Configuration.GetSection("Logging")); //loggerFactory.AddDebug(LogLevel.Debug); // if (env.IsDevelopment()) // { // app.UseDeveloperExceptionPage(); // } // else // { // app.UseExceptionHandler("/Home/Error"); //} app.UseRuntimeInfoPage("/info"); app.UseFileServer(); // Includes both middlewares below in the right order //app.UseDefaultFiles(); //app.UseStaticFiles(); // Files in wwwroot like images, html pages .etc Mapper.Initialize(config => { config.AddProfile <TripProfile>(); config.AddProfile <StopProfile>(); }); // Usually put this after serving static files. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=App}/{action=Index}/{id?}"); // defaults: new { controller = "App", action = "Index" }; }); await seeder.EnsureSeedDataAsync(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, WorldContextSeedData seeder, ILoggerFactory loggerFactory, IHostingEnvironment environment) { if (environment.IsDevelopment()) { loggerFactory.AddDebug(LogLevel.Information); app.UseDeveloperExceptionPage(); } else { loggerFactory.AddDebug(LogLevel.Error); app.UseExceptionHandler("/App/Error"); } app.UseStaticFiles(); app.UseIdentity(); Mapper.Initialize(config => { config.CreateMap<Trip, TripViewModel>().ReverseMap(); config.CreateMap<Stop, StopViewModel>().ReverseMap(); }); app.UseMvc(config => { config.MapRoute("Default", "{controller}/{action}/{id?}", new { controller = "App", action = "Index" } ); }); await seeder.EnsureSeedDataAsync(); }