// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, QuizContext quizContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); AutoMapper.Mapper.Initialize(cfg => { cfg.CreateMap <Entities.Question, Models.QuestionDto>(); cfg.CreateMap <Models.QuestionForCreationDto, Entities.Question>(); cfg.CreateMap <Entities.PossibleAnswer, Models.PossibleAnswerDto>(); cfg.CreateMap <Models.EntryForCreationDto, Entities.Entry>(); cfg.CreateMap <Models.UserForCreationDto, Entities.User>(); }); quizContext.EnsureSeedDataForContext(); app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { //spa.UseReactDevelopmentServer(npmScript: "start"); spa.UseProxyToSpaDevelopmentServer("http://localhost:3000"); } }); }