diff options
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) |
