BAEL-1416 quick guide to kong (#3448)

* BAEL-1416 quick guide to kong

* refactor kong samples
This commit is contained in:
aietcn
2018-01-20 17:09:55 +08:00
committed by Grzegorz Piwowarek
parent 3ecab4a0df
commit 7e7ccc7eb3
11 changed files with 471 additions and 1 deletions
@@ -0,0 +1,32 @@
package com.baeldung.kong;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author aiet
*/
@RestController
@RequestMapping("/stock")
public class QueryController {
private static int REQUEST_COUNTER = 0;
@GetMapping("/reqcount")
public int getReqCount(){
return REQUEST_COUNTER;
}
@GetMapping("/{code}")
public String getStockPrice(@PathVariable String code){
REQUEST_COUNTER++;
if("BTC".equalsIgnoreCase(code))
return "10000";
else return "N/A";
}
}
@@ -0,0 +1,13 @@
package com.baeldung.kong;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StockApp {
public static void main(String[] args) {
SpringApplication.run(StockApp.class, args);
}
}
@@ -1,4 +1,4 @@
server.port=8080
server.port=9090
server.contextPath=/springbootapp
management.port=8081
management.address=127.0.0.1