website/pkg/controller/index/static.go

50 lines
1.2 KiB
Go
Raw Normal View History

2022-08-16 05:33:17 +00:00
package index
import (
"net/http"
2022-08-26 04:21:46 +00:00
"code.nonshy.com/nonshy/website/pkg/templates"
2022-08-16 05:33:17 +00:00
)
// Static pages.
func About() http.HandlerFunc {
tmpl := templates.Must("about.html")
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := tmpl.Execute(w, r, nil); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
})
}
func FAQ() http.HandlerFunc {
tmpl := templates.Must("faq.html")
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := tmpl.Execute(w, r, nil); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
})
}
func TOS() http.HandlerFunc {
tmpl := templates.Must("tos.html")
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := tmpl.Execute(w, r, nil); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
})
}
func Privacy() http.HandlerFunc {
tmpl := templates.Must("privacy.html")
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := tmpl.Execute(w, r, nil); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
})
}