@@ -4,14 +4,12 @@ import (
|
||||
"arbeitszeitmessung/endpoints"
|
||||
"arbeitszeitmessung/helper"
|
||||
"arbeitszeitmessung/models"
|
||||
"arbeitszeitmessung/templates"
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/joho/godotenv"
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
@@ -42,13 +40,13 @@ func main() {
|
||||
server.HandleFunc("/user/login", endpoints.LoginHandler)
|
||||
server.HandleFunc("/user", endpoints.UserHandler)
|
||||
server.HandleFunc("/team", endpoints.TeamHandler)
|
||||
server.Handle("/", templ.Handler(templates.NavPage()))
|
||||
server.Handle("/", http.RedirectHandler("/time", http.StatusPermanentRedirect))
|
||||
server.Handle("/static/", http.StripPrefix("/static/", fs))
|
||||
|
||||
serverSessionMiddleware := endpoints.Session.LoadAndSave(server)
|
||||
|
||||
// starting the http server
|
||||
fmt.Printf("Server is running at http://localhost:8000 exposed to port %s\n", helper.GetEnv("EXPOSED_PORT", "8000"))
|
||||
fmt.Printf("Server is running at http://localhost:%s\n", helper.GetEnv("EXPOSED_PORT", "8080"))
|
||||
log.Fatal(http.ListenAndServe(":8080", serverSessionMiddleware))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user