# CloudDisk API 文档 ## 基础配置 ```javascript const API_BASE = 'http://localhost:3000/api'; const token = localStorage.getItem('token'); ``` ## 认证 ### 登录 ```javascript POST /api/auth/login { username, password } // 返回: { token, user } ``` ### 注册 ```javascript POST /api/auth/register { username, password, email } // 返回: { token, userId } ``` ## 文件 ### 获取文件列表 ```javascript GET /api/files?parentId=xxx // 返回: { files: [...] } ``` ### 上传文件 ```javascript POST /api/files/upload FormData: { file: File } // 返回: { success, fileId } ``` ### 删除文件 ```javascript DELETE /api/files/:id // 返回: { success } ``` ## 分享 ### 创建分享 ```javascript POST /api/share { fileId, password?, expiresIn? } // 返回: { success, shareToken, shareUrl } ``` ## 用户 ### 获取信息 ```javascript GET /api/user/profile // 返回: { user } ```