wrappd.sh/internal/web/routes.go
2024-12-05 14:01:14 +01:00

21 lines
467 B
Go

package web
import (
"net/http"
"strings"
)
func Routes(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
handleIndex(w, r)
} else if r.URL.Path == "/upload" {
handleUpload(w, r)
} else if strings.HasPrefix(r.URL.Path, "/results/") {
handleResults(w, r)
} else if strings.HasPrefix(r.URL.Path, "/static/") {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("assets"))))
} else {
http.NotFound(w, r)
}
}