// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, DbKwikemartContext dbContext ) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); // ===== Use Authentication ====== app.UseAuthentication(); app.UseMvc(); app.Use(async(context, next) => { await next(); if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith("/api/")) { context.Request.Path = "/index.html"; await next(); } }); app.UseMvcWithDefaultRoute(); app.UseDefaultFiles(); app.UseStaticFiles(); // ===== Create tables ====== dbContext.Database.EnsureCreated(); }
public ProductController(DbKwikemartContext dbContext) { _dbContext = dbContext; }