// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, PickupDbContext context) { // MIGRATE DATABASE IF PRODUCTION if (Globals.env["DOTNET_ENV"] == "Production") { context.Database.Migrate(); } // MIGRATE DATABASE IF PRODUCTION // Makes the API open for any queries // !!!!!!!!! NOT SECURE !!!!!!!! // !!!!!!!!! NOT SECURE !!!!!!!! // !!!!!!!!! NOT SECURE !!!!!!!! app.UseCors(options => options.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().AllowCredentials()); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } if (Globals.env["DOTNET_ENV"] == "Production") { app.UseStaticFiles(); } else { app.UseStaticFiles(new StaticFileOptions() { OnPrepareResponse = context2 => { context2.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store"); context2.Context.Response.Headers.Add("Expires", "-1"); } }); } app.UseMvc(); }
public PickupsController(PickupDbContext context) { _context = context; }