Example #1
0
        /// <summary>
        ///		This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AppSettings appSettings)
        {
            if (env.IsDevelopment())
            {
                // CORS is used for development only
                app.UseCors();
            }
            else
            {                   // Enforce use of HTTPS
                app.UseHsts();
                app.UseHttpsRedirection();
            }

            app.AddAppExceptionHandler(env);

            app.UseAuthentication();

            app.AddAppSwaggerUi();

            // Matches request to an endpoint
            app.UseRouting();
            // Executes the matched endpoint
            app.UseEndpoints(endpoints =>
                             endpoints.MapControllers()    // Maps attributes on the controllers, like, [Route], [HttpGet], etc.
                             );

            app.AddAppSpaStaticFiles(appSettings.UserApiKey);
        }