Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, CrudContext entityManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseWebSockets();
            app.UseMiddleware <RequestFilter> ();
            app.UseMvc();
            String root = Path.Combine(Directory.GetCurrentDirectory(), "src/main/webapp");

            if (Directory.Exists(root))
            {
                app.UseFileServer(new FileServerOptions {
                    FileProvider = new PhysicalFileProvider(root)
                });
            }
            else
            {
                Console.WriteLine("Directory fail : " + root);
            }

            //			app.UseResponseCompression();
            //			app.UseMvcWithDefaultRoute();
            RequestFilter.UpdateCrudServices(entityManager);
        }