You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
668 B

  1. package main
  2. import (
  3. "flag"
  4. "net/http"
  5. "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Api"
  6. "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
  7. "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database/Seeder"
  8. "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Frontend"
  9. "github.com/gorilla/mux"
  10. )
  11. var (
  12. seed bool
  13. )
  14. func init() {
  15. Database.Init()
  16. flag.BoolVar(&seed, "seed", false, "Seed database for development")
  17. flag.Parse()
  18. }
  19. func main() {
  20. var (
  21. router *mux.Router
  22. )
  23. if seed {
  24. Seeder.Seed()
  25. return
  26. }
  27. router = mux.NewRouter()
  28. Api.InitApiEndpoints(router)
  29. Frontend.InitFrontendRoutes(router)
  30. http.ListenAndServe(":8080", router)
  31. }