summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-09-15 18:07:13 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-09-15 18:07:18 (GMT)
commit06ed087d55a9814bf908f8b455b465d3a7d41710 (patch)
treed7493e6ca5fcd74ac230e653226ea66f6cde8a42
parent104245c0bb7acb926633ecca0985fbaf1917ba85 (diff)
got rid of martini
-rw-r--r--Makefile2
-rw-r--r--src/helsinki.at/rhimportd/rhimportd.go21
2 files changed, 10 insertions, 13 deletions
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)
}