예제 #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, ILoggerFactory loggerFactory, MoviesContext moviesContext)
        {
            loggerFactory.AddConsole();

            loggerFactory.AddDebug(LogLevel.Warning);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseStatusCodePages();
            app.UseMvc();

            // Populate db
            moviesContext.EnsureSeedDataForContext();

            AutoMapper.Mapper.Initialize(config =>
            {
                config.CreateMap <Movie, MovieDto>();
            });

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Movies API");
                c.RoutePrefix = string.Empty;
            });
        }