~huyngo/yue

bc6433d95346b06fc8341d79d4547e171870846d — Huy Ngo 11 months ago b956b38
Add static file serving
2 files changed, 2 insertions(+), 5 deletions(-)

M home.go
M main.go
M home.go => home.go +0 -5
@@ 7,11 7,6 @@ import (
)

func HomePage(w http.ResponseWriter, r *http.Request) {
	if r.URL.Path != "/" {
		http.NotFound(w, r)
		return
	}

	files := []string{
		"./templates/pages/home.tmpl",
		"./templates/base.tmpl",

M main.go => main.go +2 -0
@@ 8,7 8,9 @@ import (

func main() {
	r := mux.NewRouter()
	fs := http.FileServer(http.Dir("assets/"))

	r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", fs))
	r.HandleFunc("/", HomePage)

	http.ListenAndServe(":8080", r)