stevenbooru/vendor/src/github.com/yosssi/ace/examples/change_action_delimiter/main.go

31 lines
566 B
Go

package main
import (
"net/http"
"github.com/yosssi/ace"
)
func handler(w http.ResponseWriter, r *http.Request) {
tpl, err := ace.Load("example", "", &ace.Options{
DelimLeft: "<%",
DelimRight: "%>",
})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
data := map[string]interface{}{
"Msg": "Hello Ace",
}
if err := tpl.Execute(w, data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}