I have already explained how to write API endpoint using Gorilla web toolkit. And also we have some experience of Go with MYSQL database. Today will write API endpoints with Gorilla and MongoDB as database.
First we need to download Golang MongoDB driver. MGo offers rich functionality as a MongoDB driver for Golang.
TodoList and TodoListItem structs.
main.go file and configure routes accordingly.
TodoListGetAll function should be like below.
TodoListGetByOwner function should be like below.
TodoListUpdateItem function should be like below.
http://localhost:3000/api/todolist/. You will see an output like below.