The application uses SQLite as its persistence layer.
It consists of 2 tables with PK-FK relationship: todolist
& todos
.
main.go
initializes the db and inserts dummy data into it (data insertion commented).
Path: /todolist
Method: POST
Data: {"listName":"<list_name>"}
Try it: curl -X POST http://107.173.51.44/todolist -d '{"listName":"Sample todo list"}'
Path: /todolist
Method: GET
Try it: curl -X GET http://107.173.51.44/todolist
Path: /todolist/{todolistid}
Method: DELETE
URL params: <todolistid>
Try it: curl -X DELETE http://107.173.51.44/todolist/7
Path: /todos/{todolistid}
Method: POST
URL params: <todolistid>
Data: {"taskName": "<task_name>"}
Try it: curl -X POST http://107.173.51.44/todos/1 -d '{"taskName": "Sample task name"}'
Path: /todos
Method: PUT
Data: {"id": <todo_id>, "todoListId":<new_todo_list_id>, "taskName":"<new_task_name>"}
Try it: curl -X PUT http://107.173.51.44/todos -d '{"id": 1, "todoListId":1, "taskName":"just updated this"}'
Path: /todos/{todolistid}
Method: DELETE
URL params: <todolistid>
Try it: curl -X DELETE http://107.173.51.44/todos/7
Path: /todos
Method: GET
Try it: curl -X GET http://107.173.51.44/todos
- Use HTTP status codes for API return values
- Correct the PK-FK relationship in SQLite
- Create universal DB object and pass it around instead of initialising everytime
- Add a free-to-use educational license
- Lowercase the folder
DL
Dockerize the appHost the app on private VPS for working demo- Password protect the APIs
- Add
bool
to track whether todo is completed or no - Write a common logger