diff options
| author | Horus3 | 2015-02-19 02:38:34 +0100 |
|---|---|---|
| committer | Horus3 | 2015-02-19 02:38:34 +0100 |
| commit | f53fa2f2f9eb445527e0a1b29b9e37c224499233 (patch) | |
| tree | 229cc07cb4713a01393d4775f98ec733baa2afe7 /app/main.go | |
| parent | 58e63343703e0c3f3c12934e62fc0f4575761869 (diff) | |
| download | statuspage-f53fa2f2f9eb445527e0a1b29b9e37c224499233.tar.gz | |
Reorder files and parses templates.
Diffstat (limited to 'app/main.go')
| -rw-r--r-- | app/main.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/main.go b/app/main.go new file mode 100644 index 0000000..0a8b7dd --- /dev/null +++ b/app/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "github.com/gorilla/mux" + "github.com/gorilla/schema" + "html/template" + "net/http" +) + +var decoder = schema.NewDecoder() + +//var mainTempl = template.Must(template.New("global").ParseFiles("templates/header.html", "templates/navbar.html", "templates/footer.html")) +var mainTempl = template.Must(template.New("global").ParseGlob("../templates/*.html")) + +func main() { + InitDB() + + r := mux.NewRouter() + r.HandleFunc("/", IndexHandler) + r.HandleFunc("/register", RegisterHandler).Methods("POST") + r.HandleFunc("/register", PrintRegisterHandler).Methods("GET") + r.HandleFunc("/new", AddNewJobHandler).Methods("POST") + r.HandleFunc("/new", PrintNewJobHandler).Methods("GET") + http.Handle("/", r) + http.ListenAndServe(":8080", nil) +} |
