diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-09-15 18:07:13 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-09-15 18:07:18 (GMT) |
commit | 06ed087d55a9814bf908f8b455b465d3a7d41710 (patch) | |
tree | d7493e6ca5fcd74ac230e653226ea66f6cde8a42 /src/helsinki.at/rhimportd/rhimportd.go | |
parent | 104245c0bb7acb926633ecca0985fbaf1917ba85 (diff) |
got rid of martini
Diffstat (limited to 'src/helsinki.at/rhimportd/rhimportd.go')
-rw-r--r-- | src/helsinki.at/rhimportd/rhimportd.go | 21 |
1 files changed, 9 insertions, 12 deletions
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) } |