main.go 549 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "log"
  6. "net/http"
  7. "rate-it-api/utils"
  8. )
  9. func main() {
  10. router := APIRouter()
  11. port := flag.String("port", "8080", "API port")
  12. configFile := flag.String("config", "./config/config.yml", "Configuration file")
  13. flag.Parse()
  14. // set configuration
  15. utils.SetConfig(*configFile)
  16. //Running
  17. fmt.Println(fmt.Sprintf("->Running Rate-it API on 0.0.0.0:%s", *port))
  18. fmt.Println(fmt.Sprintf("->Running Rate-it API with configuration file %s ", *configFile))
  19. log.Fatal(http.ListenAndServe(":"+*port, router))
  20. }