From 06ed087d55a9814bf908f8b455b465d3a7d41710 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 15 Sep 2015 20:07:13 +0200 Subject: got rid of martini diff --git a/Makefile b/Makefile index 244e107..a33f9d7 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ GOCMD := go getlibs: export GOPATH=$(curdir) getlibs: - $(GOCMD) get "github.com/go-martini/martini" +# $(GOCMD) get "github.com/gorilla/websocket" vet: export GOPATH=$(curdir) vet: diff --git a/src/helsinki.at/rhimportd/rhimportd.go b/src/helsinki.at/rhimportd/rhimportd.go index c9f3a0f..01092ef 100644 --- a/src/helsinki.at/rhimportd/rhimportd.go +++ b/src/helsinki.at/rhimportd/rhimportd.go @@ -26,19 +26,12 @@ package main import ( "flag" - - "github.com/go-martini/martini" + "fmt" + "html" + "net/http" + _ "net/http/pprof" ) -func RunMartini(addr string) { - m := martini.Classic() - m.Get("/", func() string { - return "Hello world!" - }) - - m.RunOnAddr(addr) -} - func main() { addr_s := flag.String("addr", ":4000", "addr:port to listen on, default: ':4000'") help := flag.Bool("help", false, "show usage") @@ -49,5 +42,9 @@ func main() { return } - RunMartini(*addr_s) + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) + }) + + http.ListenAndServe(*addr_s, nil) } -- cgit v0.10.2