aboutsummaryrefslogtreecommitdiff
path: root/main.go
blob: ce280ba1ed6539754a7dd5f9c90142acae32fbe2 (plain) (blame)
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
28
29
30
package main

import (
	"os"
	"log"
	"net/http"
	"fmt"

	"github.com/gorilla/sessions"
)

var store = sessions.NewCookieStore([]byte(os.Getenv("SESSION_KEY")))

func handleHome(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, world!")
}

func main() {
	http.HandleFunc("/", handleHome)

	bind_addr := os.Getenv("HTTP_BIND_ADDR")
	if bind_addr == "" {
		bind_addr = ":9991"
	}

	err := http.ListenAndServe(bind_addr, nil)
	if err != nil {
		log.Fatal("Cannot start http server: ", err)
	}
}