Ejemplo n.º 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
	}
}
Ejemplo n.º 2
0
func (f *FileHandler) ServeReq(c *web.ChainedReq) {
	//http.ServeFile()
	f.ServeHTTP(c.Resp, c.Req)
	c.State = web.STOPPED
}