You've already forked go-template-container-webserver
go webserver template added
Some checks failed
Update Child Repos / update (push) Failing after 1m2s
Some checks failed
Update Child Repos / update (push) Failing after 1m2s
This commit is contained in:
26
version.go
Normal file
26
version.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed templates/html/version.html
|
||||
var versionTemplate string
|
||||
|
||||
func handleVersion(w http.ResponseWriter, r *http.Request) {
|
||||
type SiteInfo struct {
|
||||
CommitId string
|
||||
Name string
|
||||
Version string
|
||||
}
|
||||
|
||||
tmpl, _ := template.New("version.html").Parse(versionTemplate)
|
||||
// Return (write) the version to the response body
|
||||
tmpl.Execute(w, SiteInfo{
|
||||
CommitId: COMMIT_ID,
|
||||
Name: "YASKM",
|
||||
Version: APP_VERSION,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user