-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (29 loc) · 777 Bytes
/
main.go
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
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"flag"
"net/http"
"runtime"
"net/http/pprof"
_ "github.com/go-sql-driver/mysql"
"github.com/gosagawa/isucon/controller"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
)
func main() {
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
flag.Set("bind", ":8080")
rooter(goji.DefaultMux)
goji.Serve()
pprofMux := web.New()
pprofMux.Get("/debug/pprof/", http.HandlerFunc(pprof.Index))
}
func rooter(m *web.Mux) http.Handler {
m.Get("/user/index", controller.UserIndex)
m.Get("/user/new", controller.UserNew)
m.Post("/user/new", controller.UserCreate)
m.Get("/user/edit/:id", controller.UserEdit)
m.Post("/user/update/:id", controller.UserUpdate)
m.Get("/user/delete/:id", controller.UserDelete)
return m
}