Skip to content

Commit 684dffe

Browse files
committed
chore : add actuator & robot.txt
1 parent d7cbd9b commit 684dffe

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
<artifactId>spring-boot-starter-cache</artifactId>
9191
</dependency>
9292

93+
<dependency>
94+
<groupId>org.springframework.boot</groupId>
95+
<artifactId>spring-boot-starter-actuator</artifactId>
96+
</dependency>
97+
9398
<dependency>
9499
<groupId>org.xerial</groupId>
95100
<artifactId>sqlite-jdbc</artifactId>

src/main/java/com/rajat_singh/leetcode_api/controller/ApiOverviewController.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,18 @@ public ResponseEntity<Map<String, Object>> getApiOverview() {
9090

9191
return ResponseEntity.ok(overview);
9292
}
93+
94+
@GetMapping(path = "/robots.txt", produces = "text/plain")
95+
public ResponseEntity<String> robotsTxt() {
96+
String content = """
97+
User-agent: *
98+
Disallow: /
99+
""";
100+
return ResponseEntity.ok(content);
101+
}
102+
103+
@GetMapping(path = "", produces = "application/json")
104+
public ResponseEntity<Map<String, Object>> getApiOverviewNoSlash() {
105+
return getApiOverview();
106+
}
93107
}

src/main/resources/application.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ app:
3939
api:
4040
secret: ""
4141

42+
management:
43+
endpoints:
44+
web:
45+
exposure:
46+
include: health,info,metrics,prometheus
47+
endpoint:
48+
health:
49+
# Show detailed health status, including cache and DB checks.
50+
show-details: always
51+
caches:
52+
enabled: true
53+
54+
4255
bucket4j:
4356
cache-name: "default"
4457
enabled: true

0 commit comments

Comments
 (0)