|
| 1 | +package com.going.server.global.temp.controller; |
| 2 | + |
| 3 | +import com.going.server.global.temp.service.FastApiService; |
| 4 | +import io.swagger.v3.oas.annotations.Operation; |
| 5 | +import io.swagger.v3.oas.annotations.media.Content; |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 8 | +import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| 9 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 10 | +import lombok.RequiredArgsConstructor; |
| 11 | +import org.springframework.http.ResponseEntity; |
| 12 | +import org.springframework.web.bind.annotation.GetMapping; |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | +import org.springframework.web.bind.annotation.RestController; |
| 15 | + |
| 16 | +@RestController |
| 17 | +@RequiredArgsConstructor |
| 18 | +@RequestMapping("/api") |
| 19 | +@Tag(name = "FastAPI 통신 테스트", description = "FastAPI 서버와의 통신을 테스트하는 API") |
| 20 | +public class FastApiController { |
| 21 | + private final FastApiService fastApiService; |
| 22 | + @GetMapping("/test-fastapi") |
| 23 | + @Operation( |
| 24 | + summary = "FastAPI 서버 테스트", |
| 25 | + description = "FastAPI 서버에 GET 요청을 보내고 정상적인 응답이 오는지 확인합니다." |
| 26 | + ) |
| 27 | + @ApiResponses({ |
| 28 | + @ApiResponse( |
| 29 | + responseCode = "200", |
| 30 | + description = "FastAPI 서버가 정상적으로 응답을 반환", |
| 31 | + content = @Content( |
| 32 | + mediaType = "application/json", |
| 33 | + schema = @Schema(example = "{\"message\":\"FastAPI is running!\"}") |
| 34 | + ) |
| 35 | + ) |
| 36 | + }) |
| 37 | + public ResponseEntity<String> testFastApi() { |
| 38 | + String response = fastApiService.callFastApi(); |
| 39 | + return ResponseEntity.ok(response); |
| 40 | + } |
| 41 | +} |
0 commit comments