zuul api gateway code example
Example 1: spring boot eureka , zual hystrix, rest api docs
@Autowired
private EurekaClient discoveryClient;
public String serviceUrl() {
InstanceInfo instance = discoveryClient.getNextServerFromEureka("STORES", false);
return instance.getHomePageUrl();
}
Example 2: zuul routing tutorial
server:
port: 8111
spring:
application:
name: zuulserver
zuul:
routes:
products:
path: /api/demo/**
url: http://localhost:8080/