portfolio/web/webRoutes.go

23 lines
662 B
Go
Raw Normal View History

2024-05-16 18:42:31 +02:00
package web
2024-05-16 17:59:21 +02:00
import (
"net/http"
2024-05-16 22:56:04 +02:00
"portfolio/web/handlers"
2024-05-16 17:59:21 +02:00
)
func WebRoutes() *http.ServeMux {
// Create a new request multiplexer
// Take incoming requests and dispatch them to the matching webHandler
mux := http.NewServeMux()
// Register the routes and webHandler
2024-05-16 22:56:04 +02:00
mux.HandleFunc("/", handlers.HomePageHandler)
2024-05-18 13:43:22 +02:00
mux.HandleFunc("/projects", handlers.ProjectPageHandler)
mux.HandleFunc("/projects/edit", handlers.CreateProjectEditBody)
2024-05-19 00:21:08 +02:00
mux.HandleFunc("/about", handlers.AboutPageHandler)
2024-05-19 23:56:53 +02:00
mux.HandleFunc("/login", handlers.LoginPageHandler)
2024-05-16 17:59:21 +02:00
2024-05-16 22:56:04 +02:00
mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./web/assets"))))
2024-05-16 17:59:21 +02:00
return mux
}