-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wonseok
committed
Jan 2, 2025
1 parent
4a93a6d
commit 38d8b38
Showing
4 changed files
with
69 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
# Use a base image for running the application | ||
FROM openjdk:17-jdk-slim | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the pre-built JAR file into the container | ||
COPY /app/build/libs/app-0.0.1-SNAPSHOT.jar app.jar | ||
|
||
# Expose port 8080 for the Spring application | ||
FROM openjdk:17 | ||
ARG JAR_FILE=build/libs/karrot-0.0.1-SNAPSHOT.jar | ||
COPY ${JAR_FILE} /app.jar | ||
EXPOSE 8080 | ||
|
||
# Specify the entry point for the application | ||
ENTRYPOINT ["java", "-jar", "app.jar"] | ||
ENTRYPOINT ["java", "-jar", "/app.jar"] |
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/com/toyProject7/karrot/test/controller/TestController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.toyProject7.karrot.test.controller | ||
|
||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
class TestController { | ||
@GetMapping("/api/test") | ||
fun getTest(): ResponseEntity<TestResponse> { | ||
return ResponseEntity.ok(TestResponse(1, 2, "2번 테스트 제목", "2번 테스트 본문내용")) | ||
} | ||
|
||
@GetMapping("/api/test2") | ||
fun getTest2(): ResponseEntity<TestResponse> { | ||
return ResponseEntity.ok(TestResponse(11, 22, "22번 테스트 제목", "22번 테스트 본문내용")) | ||
} | ||
|
||
@PostMapping("/api/test3") | ||
fun postTest( | ||
@RequestBody request: TestResponse, | ||
): ResponseEntity<TestResponse> { | ||
val response = TestResponse(request.userId, request.id, request.title, request.body) | ||
return ResponseEntity.ok(response) | ||
} | ||
} | ||
|
||
data class TestResponse( | ||
val userId: Int, | ||
val id: Int, | ||
val title: String, | ||
val body: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters