API Gateway & Routing with Spring Cloud Gateway

    Question 1API GATEWAY - Purpose of Spring Cloud Gateway

    What is the primary role of Spring Cloud Gateway in a microservices architecture?

    Question 2API GATEWAY - Code Snippet (Basic Route)

    What does this configuration achieve?

    @Bean public RouteLocator routes(RouteLocatorBuilder builder) { return builder.routes() .route("order_route", r -> r.path("/orders/**") .uri("http://localhost:8081")) .build(); }

    Question 3API GATEWAY - Using Service Discovery

    How do we enable service discovery–based routing in Spring Cloud Gateway with Eureka?

    Question 4API GATEWAY - Code Snippet (Discovery Routing)

    What does this route config do?

    spring: cloud: gateway: routes: - id: payment_route uri: lb://payment-service predicates: - Path=/payments/**

    Question 5API GATEWAY - Predicates in Routing

    What do Predicates in Spring Cloud Gateway define?

    Question 6API GATEWAY - Code Snippet (Header Predicate)

    What does this config enforce?

    spring: cloud: gateway: routes: - id: auth_route uri: http://localhost:8082 predicates: - Header=X-Auth-Token, .+

    Question 7API GATEWAY - Filters

    What is the purpose of filters in Spring Cloud Gateway?

    Question 8API GATEWAY - Code Snippet (Add Request Header Filter)

    What does this filter configuration do?

    spring: cloud: gateway: routes: - id: log_route uri: http://localhost:8083 predicates: - Path=/logs/** filters: - AddRequestHeader=X-App-Name, GatewayService

    Question 9API GATEWAY - Global Filters

    What is true about Global Filters in Spring Cloud Gateway?

    Question 10API GATEWAY - Rate Limiting

    How can Spring Cloud Gateway implement API rate-limiting?