diff options
| author | Horus3 | 2015-02-25 16:41:52 +0100 |
|---|---|---|
| committer | Horus3 | 2015-02-25 16:41:52 +0100 |
| commit | 49ffcba2c3c4a19d147dd792d7f6c99b7545a491 (patch) | |
| tree | 4fbd8a283ef7ab13f92e11e5030ad5c362be4524 /app/main.go | |
| parent | 9e1d8d0fb2b57903b1c6c0c2765b7808655c74a0 (diff) | |
| download | statuspage-49ffcba2c3c4a19d147dd792d7f6c99b7545a491.tar.gz | |
UX on front end.
Diffstat (limited to 'app/main.go')
| -rw-r--r-- | app/main.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/main.go b/app/main.go index b2c210c..4c3f9f7 100644 --- a/app/main.go +++ b/app/main.go @@ -15,10 +15,14 @@ var decoder = schema.NewDecoder() var store = sessions.NewCookieStore([]byte(RandomKey())) -var mainTempl = template.Must(template.New("global").ParseGlob("../views/*.html")) +var mainTempl = template.Must(template.New("global").Funcs(template.FuncMap{"add": add}).ParseGlob("../views/*.html")) var c = cron.New() +func add(x, y int) int { + return x + y +} + func main() { decoder.IgnoreUnknownKeys(true) store.Options = &sessions.Options{ @@ -40,6 +44,9 @@ func main() { r := mux.NewRouter() r.HandleFunc("/", IndexHandler) + r.HandleFunc("/login", LoginHandler).Methods("POST") + r.HandleFunc("/login", PrintLoginHandler).Methods("GET") + r.HandleFunc("/logout", LogoutHandler) r.HandleFunc("/session", SessionHandler) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./../static")))) r.HandleFunc("/register", RegisterHandler).Methods("POST") @@ -47,6 +54,7 @@ func main() { r.HandleFunc("/new", AddNewJobHandler).Methods("POST") r.HandleFunc("/new", PrintNewJobHandler).Methods("GET") r.HandleFunc("/jobs", ShowJobHandler) + r.HandleFunc("/admin", AdminHandler) http.Handle("/", r) |
