diff --git a/docs/src/main/asciidoc/sagan-boot.adoc b/docs/src/main/asciidoc/sagan-boot.adoc new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/main/asciidoc/sagan-index.adoc b/docs/src/main/asciidoc/sagan-index.adoc new file mode 100644 index 00000000..0401f2e0 --- /dev/null +++ b/docs/src/main/asciidoc/sagan-index.adoc @@ -0,0 +1,46 @@ +This project provides a library for building an API Gateway on top of Spring MVC. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency. + +## Features + +Spring Cloud Gateway features: + +* Built on Spring Framework 5, Project Reactor and Spring Boot 2.0 +* Able to match routes on any request attribute. +* Predicates and filters are specific to routes. +* Hystrix Circuit Breaker integration. +* Spring Cloud DiscoveryClient integration +* Easy to write Predicates and Filters +* Request Rate Limiting +* Path Rewriting + +## Getting Started + +```java +@SpringBootApplication +public class DemogatewayApplication { + @Bean + public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { + return builder.routes() + .route("path_route", r -> r.path("/get") + .uri("http://httpbin.org")) + .route("host_route", r -> r.host("*.myhost.org") + .uri("http://httpbin.org")) + .route("rewrite_route", r -> r.host("*.rewrite.org") + .filters(f -> f.rewritePath("/foo/(?.*)", "/${segment}")) + .uri("http://httpbin.org")) + .route("hystrix_route", r -> r.host("*.hystrix.org") + .filters(f -> f.hystrix(c -> c.setName("slowcmd"))) + .uri("http://httpbin.org")) + .route("hystrix_fallback_route", r -> r.host("*.hystrixfallback.org") + .filters(f -> f.hystrix(c -> c.setName("slowcmd").setFallbackUri("forward:/hystrixfallback"))) + .uri("http://httpbin.org")) + .route("limit_route", r -> r + .host("*.limited.org").and().path("/anything/**") + .filters(f -> f.requestRateLimiter(c -> c.setRateLimiter(redisRateLimiter()))) + .uri("http://httpbin.org")) + .build(); + } +} +``` + +To run your own gateway use the `spring-cloud-starter-gateway` dependency. \ No newline at end of file