curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false
}'
{
"id": 1,
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false,
"userId": 5
}
Create a new task for the authenticated user
curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false
}'
{
"id": 1,
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false,
"userId": 5
}
Authorization: Bearer YOUR_JWT_TOKEN
curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false
}'
{
"id": 1,
"title": "Complete API documentation",
"description": "Write comprehensive API docs for all task endpoints",
"completed": false,
"userId": 5
}