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