api gateway spring

Solutions on MaxInterview for api gateway spring by the best coders in the world

showing results for - "api gateway spring"
Marco
17 Jun 2020
1package com.javainuse.config;
2
3import org.springframework.cloud.gateway.route.RouteLocator;
4import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
5import org.springframework.context.annotation.Bean;
6import org.springframework.context.annotation.Configuration;
7
8@Configuration
9public class SpringCloudConfig {
10
11    @Bean
12    public RouteLocator gatewayRoutes(RouteLocatorBuilder builder) {
13        return builder.routes()
14                .route(r -> r.path("/employee/**")
15                        .uri("http://localhost:8081/")
16                        .id("employeeModule"))
17
18                .route(r -> r.path("/consumer/**")
19                        .uri("http://localhost:8082/")
20                        .id("consumerModule"))
21                .build();
22    }
23
24}
25