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

33 lines
583 B
Go

package main
import (
"net/http"
"github.com/yosssi/ace"
)
func handler(w http.ResponseWriter, r *http.Request) {
tpl, err := ace.Load("example", "", nil)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
data := map[string]interface{}{
"Title": "Actions",
"Msgs": []string{
"Message1",
"Message2",
"Message3",
},
}
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)
}