wrappd.sh/internal/web/routes.go

21 lines
467 B
Go
Raw Permalink Normal View History

2024-12-05 14:00:58 +01:00
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)
}
}