From 7312599c8b01c0a2c6d989060f9c9a8b16b1c144 Mon Sep 17 00:00:00 2001 From: kreativmonkey Date: Tue, 16 May 2017 16:09:52 +0200 Subject: [PATCH] init testing --- handlers.go | 2 +- main.go | 9 +++++++++ routs.go | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/handlers.go b/handlers.go index bd3b88c..f430f0c 100644 --- a/handlers.go +++ b/handlers.go @@ -83,7 +83,7 @@ func lookupJSON(w http.ResponseWriter, r *http.Request){ var respond response if ok := short.GetAPI(queryu, &result); ok { respond := response{ - Action: "shorten", + Action: "lookup", Result: result, } diff --git a/main.go b/main.go index 3612ae4..5b2c362 100644 --- a/main.go +++ b/main.go @@ -47,9 +47,18 @@ type shrt struct { func main() { router := NewRouter() + s := http.StripPrefix("/css/", http.FileServer(http.Dir("./template/css/"))) + router.PathPrefix("/css/").Handler(s) + s = http.StripPrefix("/img/", http.FileServer(http.Dir("./template/img/"))) + router.PathPrefix("/img/").Handler(s) + + /* http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("template/css")))) http.Handle("/img/", http.StripPrefix("/img/", http.FileServer(http.Dir("template/img")))) + */ fmt.Printf("Shrt %s started on Port: %s \n", version, port) + http.Handle("/", router) + log.Fatal(http.ListenAndServe(":"+port, router)) } diff --git a/routs.go b/routs.go index af34e18..437c67f 100644 --- a/routs.go +++ b/routs.go @@ -66,4 +66,5 @@ var routes = Routes{ "/{token}", redirect, }, + } \ No newline at end of file