Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JuseungL committed Nov 26, 2024
1 parent fdae220 commit f51736b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/api-health-check/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ jar {enabled = true}

dependencies {
implementation project(':domain:domain-rds')
implementation project(':infra:infra-redis')
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
package com.drinkhere.apihealthcheck.presentations;

import com.drinkhere.infraredis.util.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/health-check")
@RequiredArgsConstructor
public class HealthCheckController {

private final RedisUtil redisUtil;
@GetMapping
public String healthCheck() {
return "This Turn is Blue!";
}

@GetMapping("redis")
public String redisConnectionCheck() {
// Redis에서 'id1' 키로 값을 가져옵니다.
String value = (String) redisUtil.getValue("id1");

// Redis에서 가져온 값이 있을 경우 반환, 없으면 기본 메시지 반환
if (value != null) {
return "value";
} else {
return "No value found for key 'id1'";
}
}
}

0 comments on commit f51736b

Please sign in to comment.