Commit 56f1a365 by Spencer Gibb

add /hosts/appName and renamed misspelled bootstrapyml

parent 2545a015
......@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -27,8 +28,13 @@ public class SidecarController {
return "OK";
}
@RequestMapping("/hosts/{appName}")
public List<ServiceInstance> hosts(@PathVariable("appName") String appName) {
return hosts2(appName);
}
@RequestMapping("/hosts")
public List<ServiceInstance> hosts(@RequestParam("appName") String appName) {
public List<ServiceInstance> hosts2(@RequestParam("appName") String appName) {
List<ServiceInstance> instances = discovery.getInstances(appName);
return instances;
}
......@@ -38,7 +44,7 @@ public class SidecarController {
return "<head><title>Sidecar</title></head><body>\n" +
"<a href='/ping'>ping</a><br/>\n" +
"<a href='/health'>health</a><br/>\n" +
"<a href='/hosts?appName="+appName+"'>hosts?appName="+appName+"</a><br/>\n" +
"<a href='/hosts/"+appName+"'>hosts/"+appName+"</a><br/>\n" +
"</body>";
}
}
......@@ -15,6 +15,9 @@ eureka:
serviceUrl:
defaultZone: http://user:password@localhost:8761/eureka/
ribbon:
ServerListRefreshInterval: 5000
endpoints:
refresh:
enabled: true
......
spring:
#application:
# name: sideCarTest
cloud:
config:
username: user
password: password
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment