mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 02:07:58 +00:00
Add vendor folder to git
This commit is contained in:
parent
66cf5eaafb
commit
183585f56f
6916 changed files with 2629581 additions and 1 deletions
35
vendor/github.com/emicklei/go-restful/examples/restful-html-template.go
generated
vendored
Normal file
35
vendor/github.com/emicklei/go-restful/examples/restful-html-template.go
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"text/template"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
)
|
||||
|
||||
// This example shows how to serve a HTML page using the standard Go template engine.
|
||||
//
|
||||
// GET http://localhost:8080/
|
||||
|
||||
func main() {
|
||||
ws := new(restful.WebService)
|
||||
ws.Route(ws.GET("/").To(home))
|
||||
restful.Add(ws)
|
||||
print("open browser on http://localhost:8080/\n")
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Text string
|
||||
}
|
||||
|
||||
func home(req *restful.Request, resp *restful.Response) {
|
||||
p := &Message{"restful-html-template demo"}
|
||||
// you might want to cache compiled templates
|
||||
t, err := template.ParseFiles("home.html")
|
||||
if err != nil {
|
||||
log.Fatalf("Template gave: %s", err)
|
||||
}
|
||||
t.Execute(resp.ResponseWriter, p)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue