Encrypted messaging app
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.

45 lines
660 B

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