Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/router/faqHandler.go
akuma06 9739610311 Separated Routes and handler from Main
Everything is in the router folder in different file
2017-05-05 16:39:15 +02:00

17 lignes
No EOL
532 o
Go

package router
import(
"net/http"
"html/template"
"github.com/gorilla/mux"
)
func FaqHandler(w http.ResponseWriter, r *http.Request) {
var templates = template.Must(template.New("FAQ").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/FAQ.html"))
templates.ParseGlob("templates/_*.html") // common
err := templates.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}