- Local:
http://localhost:5000 - Production:
https://your-backend-url.onrender.com
Test if server is running
{
"message": "Backend is live!",
"status": "OK",
"endpoints": { ... }
}Health check endpoint
{
"status": "OK",
"message": "Server is running",
"timestamp": "2024-01-01T00:00:00.000Z",
"environment": "production"
}Register a new user
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123"
}Response (201):
{
"message": "User registered successfully",
"token": "jwt_token_here",
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com"
}
}Login user
Request Body:
{
"email": "john@example.com",
"password": "password123"
}Response (200):
{
"message": "Login successful",
"token": "jwt_token_here",
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com"
}
}All task routes require authentication header:
Authorization: Bearer <token>
Get all tasks for authenticated user
Response (200):
[
{
"_id": "task_id",
"title": "Task title",
"description": "Task description",
"status": "pending",
"user": "user_id",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
]Get single task by ID
Response (200):
{
"_id": "task_id",
"title": "Task title",
"description": "Task description",
"status": "pending",
"user": "user_id",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}Create new task
Request Body:
{
"title": "New Task",
"description": "Task description",
"status": "pending"
}Response (201):
{
"_id": "task_id",
"title": "New Task",
"description": "Task description",
"status": "pending",
"user": "user_id",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}Update task
Request Body:
{
"title": "Updated Task",
"description": "Updated description",
"status": "in-progress"
}Response (200):
{
"_id": "task_id",
"title": "Updated Task",
"description": "Updated description",
"status": "in-progress",
"user": "user_id",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}Delete task
Response (200):
{
"message": "Task deleted successfully"
}{
"errors": [
{
"msg": "Email is required",
"param": "email"
}
]
}{
"message": "Authentication required"
}{
"message": "Route not found"
}{
"message": "Internal Server Error"
}curl https://your-backend-url.onrender.com/curl https://your-backend-url.onrender.com/api/healthcurl -X POST https://your-backend-url.onrender.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","email":"john@example.com","password":"password123"}'curl -X POST https://your-backend-url.onrender.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"john@example.com","password":"password123"}'curl https://your-backend-url.onrender.com/api/tasks \
-H "Authorization: Bearer YOUR_TOKEN_HERE"