mirror of
https://github.com/suyiiyii/SIMS.git
synced 2026-06-23 03:36:52 +08:00
feat: 添加健康检查和问候控制器 (#7)
实现新的健康检查端点和Hello控制器以响应GET和POST请求。健康检查返回"ok"或自定义响应,而Hello控制器返回带参数的问候信息。另外,引入了springdoc-openapi以增强API文档生成能力。
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package top.suyiiyii.sims.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class HealthzController {
|
||||
@GetMapping("/healthz")
|
||||
public String healthz() {
|
||||
return "ok";
|
||||
}
|
||||
|
||||
@PostMapping("/healthz")
|
||||
public HealthzResponse healthzPost() {
|
||||
return new HealthzResponse("health");
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public static class HealthzResponse {
|
||||
private String status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package top.suyiiyii.sims.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class HelloController {
|
||||
|
||||
@GetMapping("/hello")
|
||||
public String hello(String username) {
|
||||
return "Hello " + username;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user