minor changes of frontend main
This commit is contained in:
parent
52a5fc0f3c
commit
a0641d314c
@ -12,15 +12,14 @@ func main() {
|
|||||||
render(w, "test.page.gohtml")
|
render(w, "test.page.gohtml")
|
||||||
})
|
})
|
||||||
|
|
||||||
fmt.Println("Starting front end service on port 80")
|
fmt.Println("Starting front end service on port 4000")
|
||||||
err := http.ListenAndServe(":80", nil)
|
err := http.ListenAndServe(":4000", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func render(w http.ResponseWriter, t string) {
|
func render(w http.ResponseWriter, t string) {
|
||||||
|
|
||||||
partials := []string{
|
partials := []string{
|
||||||
"./cmd/web/templates/base.layout.gohtml",
|
"./cmd/web/templates/base.layout.gohtml",
|
||||||
"./cmd/web/templates/header.partial.gohtml",
|
"./cmd/web/templates/header.partial.gohtml",
|
||||||
@ -30,9 +29,7 @@ func render(w http.ResponseWriter, t string) {
|
|||||||
var templateSlice []string
|
var templateSlice []string
|
||||||
templateSlice = append(templateSlice, fmt.Sprintf("./cmd/web/templates/%s", t))
|
templateSlice = append(templateSlice, fmt.Sprintf("./cmd/web/templates/%s", t))
|
||||||
|
|
||||||
for _, x := range partials {
|
templateSlice = append(templateSlice, partials...)
|
||||||
templateSlice = append(templateSlice, x)
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpl, err := template.ParseFiles(templateSlice...)
|
tmpl, err := template.ParseFiles(templateSlice...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user