blob: ac2f27b8d50fa4f5e9bfffde3c9ee117d3616a43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"html/template"
"net/http"
)
var decoder = schema.NewDecoder()
var mainTempl = template.Must(template.New("global").ParseGlob("../views/*.html"))
func main() {
run()
InitDB()
r := mux.NewRouter()
r.HandleFunc("/", IndexHandler)
//r.HandleFunc("/static", StaticHandler)
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./../static"))))
r.HandleFunc("/register", RegisterHandler).Methods("POST")
r.HandleFunc("/register", PrintRegisterHandler).Methods("GET")
r.HandleFunc("/new", AddNewJobHandler).Methods("POST")
r.HandleFunc("/new", PrintNewJobHandler).Methods("GET")
http.Handle("/", r)
http.ListenAndServe(":8080", nil)
}
|