A minimal backend API for managing tasks using Node.js, TypeScript, Express, Drizzle ORM, and SQLite.
-
Build the Docker image:
docker build -t todo-api-app . -
Start the container:
docker run -p 3000:3000 todo-api-app
The API will be available at: http://localhost:3000
- Method:
POST - URL:
http://localhost:3000/tasks - Request Body:
{
"text": "Buy groceries",
"status": "in progress"
}- Response:
201 Created
{
"id": 1,
"text": "Buy groceries",
"status": "in progress"
}- Method:
PUT - URL:
http://localhost:3000/tasks/1 - Request Body:
{
"status": "completed"
}- Response:
200 OKon success404 Not Foundif task does not exist
{
"message": "Updated"
}or
{
"error": "Not found"
}-
Method:
DELETE -
URL:
http://localhost:3000/tasks/1 -
Response:
200 OKon success404 Not Foundif task does not exist
{
"message": "Deleted"
}or
{
"error": "Not found"
}-
Method:
GET -
URL (all tasks):
http://localhost:3000/tasks -
URL (by status):
http://localhost:3000/tasks?status=in%20progressorhttp://localhost:3000/tasks?status=completed -
Response:
200 OK
[
{
"id": 1,
"text": "Buy groceries",
"status": "completed"
},
{
"id": 2,
"text": "Do laundry",
"status": "in progress"
}
]"in progress""completed"
Any other value will return 400 Bad Request.