Java & Spring/์คํ๋ง
[์๋ฐ][์คํ๋ง] GET ์์ฒญ์ param์ ์ค์ ํ๊ธฐ
Rainbow๐Coder
2023. 1. 1. 16:14
728x90

์บก์ฒ์ ๊ฐ์ด ์ปจํธ๋กค๋ฌ ํ๋ ๋ง๋ค์ด์ฃผ๊ณ
์๋์ ๊ฐ์ด ์์ค ์ฝ๋ ์์ฑํด์ฃผ๋ฉด ๋๋ค.
package com.bbokkie.coinner.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MarketController {
@GetMapping("/price")
public double getPrice(
@RequestParam String market, @RequestParam String coin
){
return 123.456;
}
}
๊ทธ๋ฌ๋ฉด ์ด๋ ๊ฒ ํ๋ ์ ํํ๊ฒ ์ ๋ฌํด์ฃผ๋ฉด
123.456์ด ์ถ๋ ฅ๋๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.

728x90