示例#1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // Matches request to an endpoint.
            app.UseRouting();

            // Endpoint aware middleware.
            // Middleware can use metadata from the matched endpoint.
            app.UseAuthentication();
            app.UseAuthorization();

            // Execute the matched endpoint.
            #region snippet
            app.UseEndpoints(endpoints =>
            {
                // Route-based APIs
                UserApi.Map(endpoints);
                ProductApi.Map(endpoints);

                // Map other endpoints...
                endpoints.MapRazorPages();
            });
            #endregion
        }