void Microsoft.AspNetCore.Routing.IEndpointRouteProvider.MapRoutes(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes)
 {
     routes.Map("/", Get).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/blah", Blah).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/status/{status}", StatusCode).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/slow/status/{status}", SlowTaskStatusCode).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/fast/status/{status}", FastValueTaskStatusCode).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/lag", DoAsync).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/hey/david", HelloDavid).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/hey/{name?}", GetAsync).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/hello", Hello).WithMetadata(new uController.HttpGetAttribute());
     routes.Map("/", Post).WithMetadata(new uController.HttpPostAttribute());
     routes.Map("/post-form", PostAForm).WithMetadata(new uController.HttpPostAttribute());
     routes.Map("/auth", Authed).WithMetadata(new uController.HttpGetAttribute(), new Microsoft.AspNetCore.Authorization.AuthorizeAttribute());
 }
Пример #2
0
        public static void MapHttpHandler <THttpHandler>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes) where THttpHandler : Samples.MyHandler
        {
            var handler = new MyHandlerRoutes();

            routes.Map("/", handler.Get).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/blah", handler.Blah).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/status/{status}", handler.StatusCode).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/slow/status/{status}", handler.SlowTaskStatusCode).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/fast/status/{status}", handler.FastValueTaskStatusCode).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/lag", handler.DoAsync).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/hey/david", handler.HelloDavid).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/hey/{name?}", handler.GetAsync).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/hello", handler.Hello).WithMetadata(new uController.HttpGetAttribute());
            routes.Map("/", handler.Post).WithMetadata(new uController.HttpPostAttribute());
            routes.Map("/post-form", handler.PostAForm).WithMetadata(new uController.HttpPostAttribute());
            routes.Map("/auth", handler.Authed).WithMetadata(new uController.HttpGetAttribute(), new Microsoft.AspNetCore.Authorization.AuthorizeAttribute());
        }