Todo-List-API-With-Golang MVC
Welcome to our project! This is a Todo list App made in Golang using MVC pattern and Databas(mongoDB). It allows users to quickly and easily Add,Update Delete. With this App, users can effortlessly manage their tasks and events, helping them stay organized and on top of their to-do list. We hope you enjoy and we look forward to your contributions!
- Require Firstname, Lastname Email Username, password
- Return appropriate response
- Require email and password as the post body.
- Authenticate the user through provided credentials.
- If the user is verified eg(username and password) is correct, respond with a JWT token, otherwise show the appropriate response
POST
/v1/user
(Creating new user)
{
"userid":"",
"firstname":"nungrie",
"lastname":"galadima",
"email":"nungrie0519@gmail.com",
"username": "nung",
"password": "3534"
}
name type data type description None required object (JSON) N/A
User Successfully Added
curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/user/
POST
/v1/user/login
(User login)
{
"username": "nung",
"password": "3534"
}
name type data type description None required object (JSON) N/A
User Successfully Login
curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/user/
GET
/v1/user/all
(gets all User)
None
{
"_id": "5ab6ca49-fa35-4049-8b0d-f6f35db4bc85",
"firstname": "nungrie",
"lastname": "galadima",
"email": "nungrie0519@gmail.com",
"username": "nung",
"password": "3534",
"create_at": "2023-04-19T15:49:50.982+01:00",
"update_at": "0001-01-01T00:00:00Z"
.....
}
curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/user/all
GET
/v1/user/some-unique-uuid-string
(gets a specific User by some-unique-uuid-string)
name type data type description stub_numeric_id
required int ($int64) The specific stub numeric some-unique-uuid-string
http code content-type response 200
text/plain;charset=UTF-8
string400
application/json
{"code":"400","message":"Bad Request"}
curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/user/some-specific-unique-uuid-string
PUT
/v1/user/some-specific-unique-uuid-string
(updates user by some-unique-uuid-string)
{
"_id": "5ab6ca49-fa35-4049-8b0d-f6f35db4bc85",
"firstname": "nungrie",
"lastname": "galadima",
"email": "nungrie0519@gmail.com",
"username": "nung",
"password": "3534",
}
name type data type description uuid
required string The specific unique idendifier
Successfully Updated
curl -X PUT -H "Content-Type: application/json" --data @put.json http://localhost:8080/v1/user/some-unique-uuid-string
PATCH
/v1/user/changepassword/some-unique-uuid-string
(updating a password by specific user by patching )
{
"password": "1234"
}
Password Successfully Updated
curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/user/changepassword/some-unique-uuid-string
DELETE
/v1/user/delete/some-unique-uuid-string
(Delete user by some-unique-uuid-string)
name type data type description uuid
required string The specific stub unique idendifier
Successfully Deleted
curl -X DELETE -H "Content-Type: application/json" http://localhost:8080/v1/user/delete/some-unique-uuid-string
- User Section must be satisfy before accessing the todo endpoint.
- Only accessible for authenticated users 2 fields are required: name, description and deadline of the ToDo item
- On success save the item to the database
- Return appropriate response
POST
/v1/todo
(Creating new todo)
{
"name": "DevOP",
"description": "Basic of DevOp",
"deadline": "12h"
}
name type data type description None required object (JSON) N/A
Todo created successfully
curl -X POST -H "Content-Type: application/json" --data @post.json http://localhost:8080/v1/todos/
- Only accessible for authenticated users
- Respond with an object containing the title and description of the requested ToDo
GET
/
(gets all todos)
None
http code content-type response 200
text/plain;charset=UTF-8
string
curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/todos/
GET
/some-unique-uuid
(gets todo by some-unique-uuid)
name type data type description uuid
required string T some-unique-uuid string
http code content-type response 200
text/plain;charset=UTF-8
string400
application/json
{"code":"400","message":"Bad Request"}
curl -X GET -H "Content-Type: application/json" http://localhost:8080/v1/todos/
PUT
/v1/todos/some-unique-uuid
(updates todos by some-unique-uuid)
{
"name": "DevOP",
"description": "Basic of DevOp",
"deadline": "12h"
}
name type data type description uuid
required string The specific proxy config unique idendifier
updated successfully
curl -X PUT -H "Content-Type: application/json" --data @put.json http://localhost:8080/v1/todos/some-unique-uuid-string
- Only accessible for authenticated users
- 1 fields are required: Status and Deadline of the ToDo item
- On success save an updated item to the database
- Return appropriate respon
PATCH
/v1/todos/mark/some-unique-uuid
(updating a specific todos by patching Done or Undone)
{
"status": "Done"
}
name type data type description uuid
required string The specific unique idendifier
Update successfully |
curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid
PATCH
/v1/todos/deadline/some-unique-uuid
(update the todos by patching deadline(eg 24h) )
{
"deadline": "24h"
}
name type data type description uuid
required string The specific unique-uuid string
Update successfully
curl -X PATCH -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid string
- Only accessible for authenticated users.
- On success delete the item from the database.
- Return appropriate response.
DELETE
/v1/todos/some-unique-uuid
(Delete todos by some-unique-uuid)
name type data type description uuid
required string The specific unique-uuid string
Deleted successfully
curl -X DELETE -H "Content-Type: application/json" http://localhost:8080/v1/todos/some-unique-uuid