2017-03-24 05:06:53 +00:00
|
|
|
|
package routers
|
|
|
|
|
|
2017-03-24 09:55:44 +00:00
|
|
|
|
import (
|
2017-04-02 02:38:49 +00:00
|
|
|
|
"github.com/go-macaron/binding"
|
|
|
|
|
"github.com/ouqiang/cron-scheduler/routers/install"
|
|
|
|
|
"gopkg.in/macaron.v1"
|
2017-03-24 09:55:44 +00:00
|
|
|
|
)
|
2017-03-24 05:06:53 +00:00
|
|
|
|
|
|
|
|
|
// 路由注册
|
|
|
|
|
func Register(m *macaron.Macaron) {
|
2017-04-02 02:38:49 +00:00
|
|
|
|
// 所有GET方法,自动注册HEAD方法
|
|
|
|
|
m.SetAutoHead(true)
|
|
|
|
|
// 404错误
|
|
|
|
|
m.NotFound(func(ctx *macaron.Context) {
|
|
|
|
|
ctx.HTML(404, "error/404")
|
|
|
|
|
})
|
|
|
|
|
// 50x错误
|
|
|
|
|
m.InternalServerError(func(ctx *macaron.Context) {
|
|
|
|
|
ctx.HTML(500, "error/500")
|
|
|
|
|
})
|
|
|
|
|
// 首页
|
|
|
|
|
m.Get("/", func(ctx *macaron.Context) string {
|
|
|
|
|
return "go home"
|
|
|
|
|
})
|
|
|
|
|
// 系统安装
|
|
|
|
|
m.Group("/install", func() {
|
|
|
|
|
m.Get("", install.Show)
|
|
|
|
|
m.Post("", binding.Bind(install.InstallForm{}), install.Install)
|
|
|
|
|
})
|
2017-04-02 02:19:52 +00:00
|
|
|
|
}
|