Example #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, MovieDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});

            context.seedDataContext();
            app.UseMvc();
        }
Example #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, MovieDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});

            context.seedDataContext();
            app.UseMvc();
            app.UseSwagger();
            //creates nice UI for API documentation
            //For multiple API documentation - Add SwaggerDoc->Add EndPoint for that API in middleware->Add [ApiExplorerSettings(GroupName="MovieOpenApiSpec")] inside each controller
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint("/swagger/MovieOpenApiSpec/swagger.json", "Movie API");
                //making the deafult path to go index.html which shows nice API documentation UI
                options.RoutePrefix = "";
            });
        }