init testing

master
kreativmonkey 8 years ago
parent e64cc19aaf
commit 7312599c8b

@ -83,7 +83,7 @@ func lookupJSON(w http.ResponseWriter, r *http.Request){
var respond response var respond response
if ok := short.GetAPI(queryu, &result); ok { if ok := short.GetAPI(queryu, &result); ok {
respond := response{ respond := response{
Action: "shorten", Action: "lookup",
Result: result, Result: result,
} }

@ -47,9 +47,18 @@ type shrt struct {
func main() { func main() {
router := NewRouter() 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("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("template/css"))))
http.Handle("/img/", http.StripPrefix("/img/", http.FileServer(http.Dir("template/img")))) http.Handle("/img/", http.StripPrefix("/img/", http.FileServer(http.Dir("template/img"))))
*/
fmt.Printf("Shrt %s started on Port: %s \n", version, port) fmt.Printf("Shrt %s started on Port: %s \n", version, port)
http.Handle("/", router)
log.Fatal(http.ListenAndServe(":"+port, router)) log.Fatal(http.ListenAndServe(":"+port, router))
} }

@ -66,4 +66,5 @@ var routes = Routes{
"/{token}", "/{token}",
redirect, redirect,
}, },
} }
Loading…
Cancel
Save