about summary refs log tree commit diff
path: root/src/http.go
blob: 009566368713aa174450bb27f3a25cb432610697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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!")

	// insert scoreboard here
}