예제 #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseHttpsRedirection();
            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            if (Configuration["RESET_DB"] != null && Configuration["RESET_DB"] == "1")
            {
                var loader = new SessionizeLoader(app.ApplicationServices);
                loader.LoadData("NDC_Sydney_2018.json", "NDC Sydney 2018");
            }
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseHttpsRedirection();
            app.UseMvc();

            // Comment out the following line to avoid resetting the database each time
            var loader = new SessionizeLoader(app.ApplicationServices);

            loader.LoadData("NDC_Sydney_2018.json", "NDC Sydney 2018");
        }
예제 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseMvc();

            // Comment out the following line to avoid resetting the database each time
            var loader = new SessionizeLoader(app.ApplicationServices);

            loader.LoadData("NDC_Sydney_2018.json", "NDC Sydney 2018");
        }