Refactor api.go to use a factory with named functions
Use Fprintf instead of Fprintln
Use bool instead of string for flags
Factorize api.go
Fix routes in api.go
Replace os.File with io.ReadCloser and io.Writer
Small fix