chore: add minimal API documentation at root context
This commit is contained in:
parent
5368425c1d
commit
df24350bd3
@ -14,6 +14,16 @@ spring:
|
|||||||
format_sql: true
|
format_sql: true
|
||||||
show-sql: true
|
show-sql: true
|
||||||
|
|
||||||
|
jackson:
|
||||||
|
serialization:
|
||||||
|
INDENT_OUTPUT: true
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
api-docs:
|
||||||
|
path: /v3/api-docs
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8080
|
||||||
servlet:
|
servlet:
|
||||||
|
@ -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.error.ErrorAttributeOptions;
|
||||||
import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user