Juju's Challenge - Agenda em Go

Build an HTTP API that's responsible for handling a phone agenda (I know it's obvious, but the nuances on building the project are what really matters).


The HTTP service should be configurable through flags on startup (timeouts and port to use)


An endpoint for pushing new contacts
An endpoint for editing contact information
An endpoint for deleting a contact
An endpoint for searching a contact by its id
An endpoint for searching contacts by a part of their name
An endpoint that lists all contacts


The application should have reasonable test coverage, preferably above 70%
The application should have end-to-end tests (this is a good way to try out the HTTP client)

Logs & Metrics

Log messages should be written for each endpoint hit, with the response status code and the time it took to fulfill the request
If an error occurs, a log message should be written with the response status code and a helpful error message, to help an engineer troubleshoot the issue.
Service and host metrics should be collected. I suggest using Prometheus (https://prometheus.io/docs/guides/go-application/)

Containerization and Storage

The application should contain a buildable Dockerfile (https://levelup.gitconnected.com/complete-guide-to-create-docker-container-for-your-golang-application-80f3fb59a15e) -- care on this, as using plainly the scratch image might hinder you from making HTTPS requests. Not that this will impact our example, but something to always take care of into the future
It would be nice for the application to have some type of storage to persist the data. I'll leave this open, feel free to pick any type of storage you want


stutter like insertPhonebook inside Phonebook. so I call Phonebook.insertPhonebook();
Fix database config
Add better feedback for the user