chore: add minimal API documentation at root context

This commit is contained in:
Pablo de la Torre Jamardo 2025-08-25 21:58:09 +02:00
parent 5368425c1d
commit df24350bd3
3 changed files with 42 additions and 1 deletions

View File

@ -14,6 +14,16 @@ spring:
format_sql: true
show-sql: true
jackson:
serialization:
INDENT_OUTPUT: true
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui
server:
port: 8080
servlet:

View File

@ -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;

View File

@ -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);
}
}