Ejemplo n.º 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);
            });
        }
Ejemplo n.º 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}");
        }
Ejemplo n.º 3
0
        public override void RegisterEndpoints(IEndpointBuilder endpoints)
        {
            endpoints.MapControllers();

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

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

            endpoints.MapControllers();
        }
Ejemplo n.º 5
0
 public override void RegisterEndpoints(IEndpointBuilder endpoints)
 {
     endpoints.MapControllers();
 }