yw5ncom/src/views.go
ange 186491250e
All checks were successful
/ deploy (push) Successful in 46s
feat: range over files for paths
2024-12-14 09:19:13 +00:00

26 lines
520 B
Go

package main
import (
"net/http"
)
func index(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/contact", http.StatusMovedPermanently)
}
func style(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "html/style.css")
}
func static(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path)
}
func html(w http.ResponseWriter, r *http.Request) {
if t, found := TMPL[r.URL.Path]; found {
w.Write(t)
} else {
http.NotFound(w, r)
}
}