diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..641d109 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/favicon.png b/static/favicon.png new file mode 100644 index 0000000..ae8da00 Binary files /dev/null and b/static/favicon.png differ diff --git a/templates/base.html b/templates/base.html index 2751183..484b033 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,6 +3,7 @@ barcodes + diff --git a/web/page.route.go b/web/page.route.go new file mode 100644 index 0000000..10b79a9 --- /dev/null +++ b/web/page.route.go @@ -0,0 +1,14 @@ +package web + +import ( + "fmt" + "net/http" + "strings" +) + +func mainHandler(w http.ResponseWriter, r *http.Request) { + fmt.Println("Request URL: ", r.URL.Path) + requestFile := strings.TrimRight(r.URL.Path, "/") + requestFile = strings.TrimRight(requestFile, ".html") + fmt.Println("Template File: ", requestFile) +} diff --git a/web/server.go b/web/server.go index 63767b1..8240cff 100644 --- a/web/server.go +++ b/web/server.go @@ -6,9 +6,10 @@ import ( ) func StartServer() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Barcodes") - }) + // What I want to do here is server from /static + // if the resource exists, else try to render from /templates + // if the template exists. Else return 404. + http.HandleFunc("/", mainHandler) http.HandleFunc("/help", helpTemplate)