godash/handlers/routes.go

20 lines
523 B
Go
Raw Normal View History

2024-03-12 15:49:08 +01:00
package handlers
import (
"net/http"
"github.com/r3labs/sse/v2"
)
2025-01-31 12:08:03 +01:00
func SetupRoutes(router *http.ServeMux, sse *sse.Server, appHandler *AppHandler) {
router.Handle("GET /sse", http.HandlerFunc(sse.ServeHTTP))
2024-04-12 16:19:11 +02:00
2024-05-21 17:33:13 +02:00
fsAssets := http.FileServer(http.Dir("assets"))
2025-01-31 12:08:03 +01:00
router.Handle("GET /assets/", http.StripPrefix("/assets/", fsAssets))
2024-04-12 16:19:11 +02:00
2024-06-11 19:08:02 +02:00
icons := http.FileServer(http.Dir("storage/icons"))
2025-01-31 12:08:03 +01:00
router.Handle("GET /icons/", http.StripPrefix("/icons/", icons))
2024-06-11 19:08:02 +02:00
2025-01-31 12:08:03 +01:00
router.Handle("GET /", http.HandlerFunc(appHandler.appHandler))
2024-03-12 15:49:08 +01:00
}