2022-10-20 16:59:33 +00:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"GoWeb/app"
|
|
|
|
"GoWeb/controllers"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetRoutes defines all project get routes
|
|
|
|
func GetRoutes(app *app.App) {
|
|
|
|
// Get controller struct initialize
|
|
|
|
getController := controllers.GetController{
|
|
|
|
App: app,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Serve static files
|
|
|
|
http.Handle("/file/", http.FileServer(http.Dir("./static")))
|
|
|
|
log.Println("Serving static files from: ./static")
|
|
|
|
|
|
|
|
// Pages
|
|
|
|
http.HandleFunc("/", getController.ShowHome)
|
2022-11-01 16:23:44 +00:00
|
|
|
http.HandleFunc("/login", getController.ShowLogin)
|
2022-10-20 16:59:33 +00:00
|
|
|
http.HandleFunc("/register", getController.ShowRegister)
|
2022-11-01 16:23:44 +00:00
|
|
|
http.HandleFunc("/logout", getController.Logout)
|
2022-10-20 16:59:33 +00:00
|
|
|
}
|