package main import ( "arbeitszeitmessung/endpoints" "arbeitszeitmessung/helper" "arbeitszeitmessung/models" "fmt" "log" "net/http" _ "github.com/lib/pq" ) func main() { var err error models.DB, err = OpenDatabase() if err != nil { log.Fatal(err) } defer models.DB.Close() // handles the different http routes http.HandleFunc("/time/new", endpoints.TimeCreateHandler) http.HandleFunc("/time", endpoints.TimeHandler) http.HandleFunc("/logout", endpoints.LogoutHandler) // starting the http server fmt.Printf("Server is running at http://localhost:8000 exposed to port %s\n", helper.GetEnv("EXPOSED_PORT", "8000")) log.Fatal(http.ListenAndServe(":8080", nil)) }