diff options
| author | Horus3 | 2015-03-20 17:30:11 +0100 |
|---|---|---|
| committer | Horus3 | 2015-03-20 17:30:11 +0100 |
| commit | 410504e069d37c522dca6bf820e9fc4cea2de871 (patch) | |
| tree | 75db9c44b5e852652fd8e54b8d4db91147fb77a2 /main.go | |
| parent | 9ab1f49c4c4aa5dcaa0dd50ec606ca06ca071c71 (diff) | |
| download | freemail-410504e069d37c522dca6bf820e9fc4cea2de871.tar.gz | |
Check if domain points to mail server. Add http handler to create a new entry.
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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) |
