From f53fa2f2f9eb445527e0a1b29b9e37c224499233 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Thu, 19 Feb 2015 02:38:34 +0100 Subject: Reorder files and parses templates. --- app/main.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/main.go (limited to 'app/main.go') 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) +} -- cgit v1.2.3