From 410504e069d37c522dca6bf820e9fc4cea2de871 Mon Sep 17 00:00:00 2001 From: Horus3 Date: Fri, 20 Mar 2015 17:30:11 +0100 Subject: Check if domain points to mail server. Add http handler to create a new entry. --- main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b18bd8d..b810e12 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,6 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/schema" "github.com/gorilla/sessions" - "github.com/robfig/cron" "html/template" "log" "net/http" @@ -13,14 +12,11 @@ import ( var decoder = schema.NewDecoder() -//var store = sessions.NewCookieStore([]byte(RandomKey())) var store = sessions.NewCookieStore([]byte(os.Getenv("FREEMAIL_SECRET"))) var mainTempl = template.Must(template.New("global").Funcs(template.FuncMap{"add": add}).ParseGlob("./views/*.html")) var emailTempl = template.Must(template.New("email").Funcs(template.FuncMap{"add": add}).ParseGlob("./views/email/*.html")) -var c = cron.New() - func add(x, y int) int { return x + y } @@ -36,8 +32,9 @@ func main() { InitDB() r := mux.NewRouter() - // r.HandleFunc("/", IndexHandler) - r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./../static")))) + r.HandleFunc("/", IndexHandler) + r.HandleFunc("/create", CreateNewEntryHandler).Methods("POST") + r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) http.Handle("/", r) -- cgit v1.2.3