Todo List Application Service. FullStack application
Echo - High performance, extensible, minimalist Go web framework
Make sure if you have a Golang
installed. If not install it - https://go.dev/dl/
go version
- Update .env file with your local environment variables
- Run the following command to start the server
go mod tidy
go list -m all
go run ./cmd
go build -o todo-list-service ./cmd
./todo-list-service
curl -X POST http://localhost:8000/authentication/register \
-H 'Content-Type: application/json' \
-d '{
"username": "zelenchuk",
"email": "[email protected]",
"password": "root_admin"
}'
curl -X POST http://localhost:8000/authentication/login \
-H "Content-Type: application/json" \
-d '{
"username": "newuser",
"password": "mypassword"
}'
curl -X GET -H "Authorization: Bearer [Your_JWT_Token]" http://localhost:8000/authentication/whoiam
JSON response:
{
"admin": false,
"exp": 1704704665,
"userId": 52,
"username": "zelenchuk"
}
curl -X POST http://localhost:8000/todos \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [Your_JWT_Token]' \
-d '{"Title": "Sample Todo", "Description": "This is a sample todo item", "Completed": false}'
Get all Todos
curl -X GET http://localhost:8000/todos \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer [Your_JWT_Token]"
$body = @{
Username = "example"
Email = "[email protected]"
Password = "password"
} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:8000/users" -Method Post -ContentType "application/json" -Body $body
$body = @{
username = "example"
password = "password"
}
Invoke-WebRequest -Uri "http://localhost:8000/login" -Method Post -ContentType "application/x-www-form-urlencoded" -Body $body
$headers = @{
Authorization = "Bearer <token>"
ContentType = "application/json"
}
$body = @{
Title = "Sample Todo"
Description = "This is a sample todo item"
Completed = $false
} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:8000/todos" -Method Post -Headers $headers -Body $body
$headers = @{
Authorization = "Bearer <token>"
}
Invoke-WebRequest -Uri "http://localhost:8000/todos" -Headers $headers
$headers = @{
Authorization = "Bearer <token>"
}
Invoke-WebRequest -Uri "http://localhost:8000/todos/<todo_id>/<user_id>" -Method Delete -Headers $headers
$headers = @{
Authorization = "Bearer <token>"
"Content-Type" = "application/json"
}
$body = @{
Title = "Updated Title"
Description = "Updated Description"
Completed = $true
} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:8000/todos/<todo_id>/<user_id>" -Method Put -Headers $headers -Body $body
curl -X POST https://desolate-anchorage-72827-298f3197b035.herokuapp.com/authentication/register \
-H 'Content-Type: application/json' \
-d '{
"username": "zelenchuk",
"email": "[email protected]",
"password": "root_admin"
}'
curl -X POST https://desolate-anchorage-72827-298f3197b035.herokuapp.com/authentication/login \
-H "Content-Type: application/json" \
-d '{
"username": "newuser",
"password": "mypassword"
}'
curl -X GET -H "Authorization: Bearer [Your_JWT_Token]" https://desolate-anchorage-72827-298f3197b035.herokuapp.com/authentication/whoiam
JSON response:
{
"admin": false,
"exp": 1704704665,
"userId": 52,
"username": "zelenchuk"
}
curl -X POST https://desolate-anchorage-72827-298f3197b035.herokuapp.com/todos \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [Your_JWT_Token]' \
-d '{"Title": "Sample Todo", "Description": "This is a sample todo item", "Completed": false}'
curl -X GET https://desolate-anchorage-72827-298f3197b035.herokuapp.com/todos \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer [Your_JWT_Token]"