Merge pull request #6 from nagisa77/codex/add-curl-command-example-for-controller-testing

Add curl examples for testing APIs
This commit is contained in:
Tim
2025-06-30 19:40:21 +08:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -4,6 +4,11 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/*
curl http://localhost:8080/api/admin/hello \
-H "Authorization: Bearer <token>"
*/
/**
* Simple admin demo endpoint.
*/

View File

@@ -12,6 +12,19 @@ import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/*
curl -X POST http://localhost:8080/api/posts \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{ "title": "First", "content": "Post" }'
curl http://localhost:8080/api/posts \
-H "Authorization: Bearer <token>"
curl http://localhost:8080/api/posts/1 \
-H "Authorization: Bearer <token>"
*/
@RestController
@RequestMapping("/api/posts")
@RequiredArgsConstructor