summaryrefslogtreecommitdiff
path: root/src/hub
diff options
context:
space:
mode:
authorMarkus Grüneis <gimpf@gimpf.org>2014-10-19 16:43:01 +0200
committerMarkus Grüneis <gimpf@gimpf.org>2014-10-19 16:43:01 +0200
commit4676ef2d971204064a8a5ef7d3618b542a87a790 (patch)
tree26c6f4d0a05d9e2fed82c52e133c0772ddac4f94 /src/hub
parenthub: refactor server and db initialization (diff)
hub: use goji for new s5srvWeb
Diffstat (limited to 'src/hub')
-rw-r--r--src/hub/Makefile1
-rw-r--r--src/hub/src/spreadspace.org/sfive-hub/s5hub.go6
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvWeb.go18
3 files changed, 25 insertions, 0 deletions
diff --git a/src/hub/Makefile b/src/hub/Makefile
index 317615a..1c4878b 100644
--- a/src/hub/Makefile
+++ b/src/hub/Makefile
@@ -5,6 +5,7 @@ getlibs: export GOPATH=$(curdir)
getlibs:
$(GOCMD) get "github.com/coopernurse/gorp"
$(GOCMD) get "github.com/mattn/go-sqlite3"
+ $(GOCMD) get "github.com/zenazn/goji"
build: export GOPATH=$(curdir)
build: getlibs
diff --git a/src/hub/src/spreadspace.org/sfive-hub/s5hub.go b/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
index c1802eb..bb5e80f 100644
--- a/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
+++ b/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
@@ -23,5 +23,11 @@ func main() {
server.ServePipe("/run/sfive/pipe")
}()
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ server.ServeWeb()
+ }()
+
wg.Wait()
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go
new file mode 100644
index 0000000..1b64c4b
--- /dev/null
+++ b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go
@@ -0,0 +1,18 @@
+package sfive
+
+import (
+ "fmt"
+ "net/http"
+
+ "github.com/zenazn/goji"
+ "github.com/zenazn/goji/web"
+)
+
+func hello(c web.C, w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintf(w, "Hello, %s!", c.URLParams["name"])
+}
+
+func (self StatsSinkServer) ServeWeb() {
+ goji.Get("/hello/:name", hello)
+ goji.Serve()
+}