chore: add minimal API documentation at root context
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.config;
|
||||
package com.pablotj.portfolio.infrastructure.rest.api;
|
||||
|
||||
import org.springframework.boot.web.error.ErrorAttributeOptions;
|
||||
import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.pablotj.portfolio.infrastructure.rest.api;
|
||||
|
||||
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.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping
|
||||
public class ApiRootController {
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Map<String, Object>> root() {
|
||||
Map<String, Object> response = Map.of(
|
||||
"api", "Portfolio API",
|
||||
"version", "1.0",
|
||||
"doc", "/v3/api-docs",
|
||||
"swagger", "/swagger-ui",
|
||||
"endpoints", List.of(
|
||||
Map.of("path", "/v1/projects", "description", "Manage projects"),
|
||||
Map.of("path", "/v1/experience", "description", "Experience entries"),
|
||||
Map.of("path", "/v1/about", "description", "About me")
|
||||
)
|
||||
);
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user