Beispiel #1
0
        public override void RegisterEndpoints(IEndpointBuilder endpoints)
        {
            endpoints.MapControllers();

            endpoints.MapApiDocument(
                name: "sample",
                title: "Sample Module",
                description: "The API for sample module",
                version: "1.0");

            endpoints.WithErrorHandler("Sample", "Main")
            .MapFallbackNotFound("/sample/{**slug}")
            .MapStatusCode("/sample/{**slug}")
            .MapFallbackNotFound("/route-test/{id:int}")
            .MapFallbackNotFound("/route-test/{id:alpha}");

            endpoints.MapRequestDelegate("/weather/checker", async context =>
            {
                await context.Response.WriteAsync("Hello World!");
            });

            endpoints.MapRequestDelegate("/sample/world", context =>
            {
                context.Response.StatusCode = 402;
                return(Task.CompletedTask);
            });
        }
Beispiel #2
0
        public override void RegisterEndpoints(IEndpointBuilder endpoints)
        {
            endpoints.MapControllers();
            endpoints.MapFallNotFound("/api/{**slug}");
            endpoints.MapFallNotFound("/lib/{**slug}");
            endpoints.MapFallNotFound("/images/{**slug}");

            endpoints.WithErrorHandler("Dashboard", "Root")
            .MapStatusCode("/dashboard/{**slug}");
        }
Beispiel #3
0
        public override void RegisterEndpoints(IEndpointBuilder endpoints)
        {
            endpoints.MapControllers();

            endpoints.MapFallback("/", context =>
            {
                context.Response.Redirect("/dashboard/contests");
                return(Task.CompletedTask);
            });
        }
Beispiel #4
0
        public override void RegisterEndpoints(IEndpointBuilder endpoints)
        {
            var options = endpoints.ServiceProvider.GetOptions <ApplicationInsightsDisplayOptions>();

            if (string.IsNullOrEmpty(options.Value.ApiKey))
            {
                return;
            }

            endpoints.MapControllers();
        }
Beispiel #5
0
 public override void RegisterEndpoints(IEndpointBuilder endpoints)
 {
     endpoints.MapControllers();
 }