Exemplo n.º 1
0
        public IActionResult GetRoutes()
        {
            var serviceName = actionDescriptorCollectionProvider.ActionDescriptors.Items[0].DisplayName.Split(".")[0];
            var routes      = actionDescriptorCollectionProvider.ActionDescriptors.Items.Select(a =>
            {
                return(new
                {
                    Method = RouteHelper.GetCorrectHttpMethod(a.EndpointMetadata[0].ToString()),
                    Route = a.AttributeRouteInfo.Template,
                });
            });

            return(Ok(routes));
        }
Exemplo n.º 2
0
        public ServiceRoute DiscoverRoutes()
        {
            var serviceName = actionDescriptor.ActionDescriptors.Items[0].DisplayName.Split(".")[0];
            var routes      = actionDescriptor.ActionDescriptors.Items.Select(a =>
            {
                return(new RouteModel
                {
                    Method = RouteHelper.GetCorrectHttpMethod(a.EndpointMetadata[0].ToString()),
                    Route = a.AttributeRouteInfo.Template,
                });
            });

            return(new ServiceRoute {
                ServiceName = serviceName, RouteModels = routes
            });
        }