Pracownia.Programowania/main.go

29 lines
548 B
Go
Raw Normal View History

2018-12-08 23:15:39 +01:00
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)
}