about summary refs log tree commit diff
path: root/src/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.go')
-rw-r--r--src/http.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/http.go b/src/http.go
new file mode 100644
index 0000000..e29f13e
--- /dev/null
+++ b/src/http.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+	"fmt"
+	"net/http"
+
+	"github.com/gorilla/mux"
+)
+
+// setupHTTPServer defines a new http server
+func setupHTTPServer() http.Server {
+	r := mux.NewRouter()
+
+	r.HandleFunc("/", indexHandler)
+
+	return http.Server{
+		Addr:    fmt.Sprintf("0.0.0.0:%d", *port),
+		Handler: r,
+	}
+}
+
+// indexHandler handles the "/" endpoint
+func indexHandler(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintln(w, "This is the index Handler speaking! Prepare to HACK THE PLANET!")
+}