Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ApplicationSeed applicationSeed, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddLog4Net();

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


            app.ExceptionHandler();
            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseCors(options => {
                options.WithOrigins("http://localhost:4200", "https://juniorstartng.herokuapp.com").AllowAnyHeader().AllowAnyMethod().AllowCredentials();
            });

            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub>("/chat");
            });
            app.UseMvc();
            app.EnableSwagger();
            app.UseMiddleware <JwtTokenSlidingExpirationMiddleware>();

            ApplicationSeed.SeedAsync(app.ApplicationServices).Wait();
        }
Exemplo n.º 2
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ApplicationSeed applicationSeed)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }


            app.ExceptionHandler();
            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseCors("CorsPolicy");
            app.UseMvc();
            app.EnableSwagger();
            app.UseMiddleware <JwtTokenExpirationMiddleware>();

            ApplicationSeed.SeedAsync(app.ApplicationServices).Wait();
        }