if i may a few fixes:

at the end change the line

http.ListenAndServe(":3000", router)


http.ListenAndServe(":3000", handler)

and the api as by convention it should be more like:

router.HandleFunc("/healthz", Healthz).Methods("GET")

router.HandleFunc("/todos/completed", GetCompletedItems).Methods("GET")

router.HandleFunc("/todos/incomplete", GetIncompleteItems).Methods("GET")

router.HandleFunc("/todos", CreateItem).Methods("POST")

router.HandleFunc("/todos/{id}", UpdateItem).Methods("PUT")

router.HandleFunc("/todos/{id}", DeleteItem).Methods("DELETE")

this is a very good article on how to REST API should be written




Full stack developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Full stack developer

More from Medium

BTC did it and broke $45k!

How secret network become the best privacy hub of Web 3.0

Is Celsius Network Safe? The Truth May Surprise You…

If Bitcoin existed during Holocaust, it would have been the best asset for Jews to protect wealth.