Skip to content

Instantly share code, notes, and snippets.

@i07
Created May 3, 2022 13:47
Show Gist options
  • Save i07/f022d54e13f6b9e9c940054871876eee to your computer and use it in GitHub Desktop.
Save i07/f022d54e13f6b9e9c940054871876eee to your computer and use it in GitHub Desktop.
package donkers.tutorial.medium
import org.springframework.http.HttpStatus
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.LocalDateTime
data class StatusObject(var timestamp:LocalDateTime, var message:String) {
constructor():this(LocalDateTime.now(), "Server Ok!")
}
@RestController
@RequestMapping("/")
class StatusController {
@GetMapping("status")
fun getStatus():ResponseEntity<StatusObject> {
return ResponseEntity(StatusObject(), HttpStatus.OK)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment