summaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-11 16:28:59 +0100
committerdiogo464 <[email protected]>2025-08-11 16:28:59 +0100
commit2e02765e4b79d0d145520f9005c75d382805dc2e (patch)
tree08e0279988c804ad9e4e9301a2e23648decf292d /CLAUDE.md
parent68afafc281103c32b193d5f116d87f74187bdc63 (diff)
implement RESTful API and remove legacy endpoints
- Created unified /api/fs/[...path] endpoint with full REST methods: - GET: List directory contents or file info - POST: Create directories using Drive_mkdir() - PUT: Upload files with multipart form data - DELETE: Remove files/directories using Drive_remove() - Added /api/fs route for root directory listing - Added Drive_mkdir() function to drive_server.ts using fctdrive mkdir command - Removed legacy /api/delete and /api/upload endpoints - Updated CLAUDE.md with comprehensive API documentation and examples - All endpoints support authentication with AUTH: 1 header in development - Proper error handling, file size validation, and cache revalidation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md26
1 files changed, 25 insertions, 1 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 3468c48..8fe6152 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -46,6 +46,30 @@
46- **Updates**: Manual refresh only (no real-time) 46- **Updates**: Manual refresh only (no real-time)
47- the server is running at `127.0.0.1:3000` and you can use curl to test the page 47- the server is running at `127.0.0.1:3000` and you can use curl to test the page
48 48
49## API Endpoints
50
51### Legacy Endpoints
52- `/api/list` - GET all files recursively from root
53
54### RESTful API - `/api/fs/[...path]`
55- **GET** `/api/fs/path/to/directory` - List directory contents
56- **POST** `/api/fs/path/to/directory` - Create directory
57- **PUT** `/api/fs/path/to/file.txt` - Upload/create file
58- **DELETE** `/api/fs/path/to/item` - Delete file or directory
59
49## API Testing 60## API Testing
50- For testing authenticated endpoints in development, use header `AUTH: 1` 61- For testing authenticated endpoints in development, use header `AUTH: 1`
51- Example: `curl -H "AUTH: 1" -H "Content-Type: application/json" -X POST localhost:3000/api/delete -d '{"path":"/file.txt"}'` \ No newline at end of file 62- Examples:
63 ```bash
64 # List directory
65 curl "http://localhost:3000/api/fs/some/directory"
66
67 # Create directory
68 curl -X POST "http://localhost:3000/api/fs/new_directory" -H "AUTH: 1"
69
70 # Upload file
71 curl -X PUT "http://localhost:3000/api/fs/path/file.txt" -H "AUTH: 1" -H "Content-Type: multipart/form-data" -F "file=@local_file.txt"
72
73 # Delete file/directory
74 curl -X DELETE "http://localhost:3000/api/fs/path/to/delete" -H "AUTH: 1"
75 ``` \ No newline at end of file