diff options
Diffstat (limited to 'handler.go')
| -rw-r--r-- | handler.go | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/handler.go b/handler.go deleted file mode 100644 index 16640ae..0000000 --- a/handler.go +++ /dev/null @@ -1,63 +0,0 @@ -package main - -import ( - "fmt" - "html/template" - "log" - "net/http" -) - -func IndexHandler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello World! \n") - // w.Write() -} - -func RegisterHandler(w http.ResponseWriter, r *http.Request) { - log.Println("Processing registration!") - fmt.Fprintf(w, "Processing registration! \n") - // w.Write() -} - -func PrintRegisterHandler(w http.ResponseWriter, r *http.Request) { - - fmt.Fprintf(w, "Printing register etc! \n") - // w.Write() -} - -func PrintNewJobHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("Printing job") - //t := template.Must(template.ParseFiles("templates/header.html", "templates/navbar.html", "templates/jobs.html", "templates/footer.html")) - t := template.Must(template.ParseFiles("templates/jobs.html", "templates/header.html", "templates/navbar.html", "templates/footer.html")) - //t := template.New("job") - //t := templ - //fmt.Printf("%s", t) - //t, err := template.ParseFiles("templates/jobs.html", "templates/header.html") - //t, err := template.ParseFiles("templates/jobs.html") - //t, err := t.ParseFiles("templates/jobs.html") - //if err != nil { - // log.Panic(err) - //} - err := t.Execute(w, nil) - if err != nil { - log.Panic(err) - } -} - -func AddNewJobHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("Add new job") - - err := r.ParseForm() - if err != nil { - log.Panic(err) - } - - host := &Host{} - err = decoder.Decode(host, r.PostForm) - if err != nil { - log.Panic(err) - } - - log.Printf("%v", host) - fmt.Fprintf(w, "%s", host.Url) - Db.Debug().Save(host) -} |
