🚀 TodoList API

这是一个基于 Cloudflare Workers 的 TodoList API

📚 API 端点

GET /api/todos
获取所有待办事项
POST /api/todos
创建新的待办事项
Body: {"text": "待办事项内容"}
PUT /api/todos/:id
更新待办事项
Body: {"completed": true, "text": "更新的内容"}
DELETE /api/todos/:id
删除待办事项

🧪 测试 API

你可以使用以下工具测试API:

📖 示例

// 获取所有待办事项
fetch('/api/todos')
    .then(res => res.json())
    .then(data => console.log(data));

// 创建新待办事项
fetch('/api/todos', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ text: '学习Vue3' })
})
.then(res => res.json())
.then(data => console.log(data));