Example #1
0
func rootHandler(w http.ResponseWriter, r *http.Request) {
	pwd, _ := os.Getwd()
	data := fileio.ReadFile(pwd + "/views/index.html")
	w.Header().Set("content-type", "text/html")
	n, err := w.Write(data)
	if n != len(data) && err != nil {
		panic(err)
	}
}
Example #2
0
func stylesHandler(w http.ResponseWriter, r *http.Request) {
	pwd, _ := os.Getwd()
	data := fileio.ReadFile(pwd + "/views/styles/" + mux.Vars(r)["file"])
	w.Header().Set("content-type", "text/css")
	n, err := w.Write(data)
	if n != len(data) && err != nil {
		panic(err)
	}
}