aietcn 7e7ccc7eb3 BAEL-1416 quick guide to kong (#3448)
* BAEL-1416 quick guide to kong

* refactor kong samples
2018-01-20 10:09:55 +01:00

33 lines
737 B
Java

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";
}
}