Skip to content

Commit ae819e3

Browse files
authored
Merge pull request #2 from Nexters/feat/add-dummy-controller
feat: create a dummy controller that returns a random number
2 parents fc4de48 + 30e21b0 commit ae819e3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.climbup.climbup.test.controller;
2+
3+
import io.swagger.v3.oas.annotations.Operation;
4+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
5+
import org.springframework.http.ResponseEntity;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
import java.time.LocalDateTime;
11+
import java.util.HashMap;
12+
import java.util.Map;
13+
14+
@RestController()
15+
@RequestMapping("/test")
16+
public class TestController {
17+
@Operation(summary = "랜덤 숫자 생성", description = "0-99 사이의 랜덤한 정수를 반환합니다")
18+
@ApiResponse(responseCode = "200", description = "성공적으로 랜덤 숫자를 생성함")
19+
@GetMapping()
20+
public ResponseEntity<Map<String, Object>> getRandomNumber() {
21+
Map<String, Object> response = new HashMap<>();
22+
response.put("randomNumber", (int)(Math.random() * 100));
23+
response.put("timestamp", LocalDateTime.now());
24+
return ResponseEntity.ok(response);
25+
}
26+
}

0 commit comments

Comments
 (0)