29 lines
548 B
Go
29 lines
548 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"html/template"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func index(w http.ResponseWriter, r *http.Request) {
|
||
|
t, err := template.ParseFiles(
|
||
|
"views/index.html",
|
||
|
"views/header.html",
|
||
|
"views/footer.html",
|
||
|
)
|
||
|
if err != nil {
|
||
|
fmt.Fprintf(w, err.Error())
|
||
|
}
|
||
|
t.ExecuteTemplate(w, "index", nil)
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
fmt.Println("Listening port 8080")
|
||
|
|
||
|
http.Handle("/bower_components", http.StripPrefix("/bower_components/", http.FileServer(http.Dir("./bower_components"))))
|
||
|
http.HandleFunc("/", index)
|
||
|
|
||
|
http.ListenAndServe(":8080", nil)
|
||
|
}
|