Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/main/java/com/example/coreTest/GeneratedCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.finvant.coretest.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Instant;

@RestController
@RequestMapping("/api/v1")
public class HealthController {

@GetMapping("/health")
public ResponseEntity<Object> health() {
return ResponseEntity.ok(
new HealthResponse("OK", Instant.now().toEpochMilli())
);
}

private static class HealthResponse {
private final String status;
private final long timestamp;

public HealthResponse(String status, long timestamp) {
this.status = status;
this.timestamp = timestamp;
}

public String getStatus() {
return status;
}

public long getTimestamp() {
return timestamp;
}
}
}