This repository has been archived on 2022-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
gosocial/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"
"git.kirsle.net/apps/gosocial/pkg/templates"
)
// 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
}
})
}