Ejemplo n.º 1
0
        /// <summary>
        /// Configures the application.
        /// </summary>
        /// <param name="app">The application builder instance.</param>
        /// <param name="env">The hosting environment.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseAuthentication();

            // Enabled CORS to allow access from browser applications on different domains.
            app.UseCors(builder => builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            app.UseMvc();

            // Enable Swagger and Swagger UI to make exploration of the API easier.
            app.UseSwagger();
            app.UseSwaggerUI(SwaggerConfig.ConfigureUI);
            app.UseSwaggerBearerAuthorization();

            // Start the leader board re-calculation timer.
            DomainModule.StartTimer(app.ApplicationServices);
        }