예제 #1
0
func (s *StaticHtmlHandler) ServeReq(c *web.ChainedReq) {
	r := c.Req
	w := c.Resp

	if path, isHtml := s.computeHtmlPath(r); isHtml {

		t, err := template.ParseFiles(config.HTML_FOLDER + path)

		if err != nil {
			http.Error(w, "[resource] Resource not found"+path, 404)
			return
		}

		t.Execute(w, nil)
		c.State = web.STOPPED
	}
}
예제 #2
0
파일: fileHandler.go 프로젝트: goarne/blog
func (f *FileHandler) ServeReq(c *web.ChainedReq) {
	//http.ServeFile()
	f.ServeHTTP(c.Resp, c.Req)
	c.State = web.STOPPED
}