summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorHorus32015-03-20 17:30:11 +0100
committerHorus32015-03-20 17:30:11 +0100
commit410504e069d37c522dca6bf820e9fc4cea2de871 (patch)
tree75db9c44b5e852652fd8e54b8d4db91147fb77a2 /main.go
parent9ab1f49c4c4aa5dcaa0dd50ec606ca06ca071c71 (diff)
downloadfreemail-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.go9
1 files changed, 3 insertions, 6 deletions
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)