mirror of https://github.com/ouqiang/gocron
30 lines
672 B
Go
30 lines
672 B
Go
package routers
|
||
|
||
import (
|
||
"gopkg.in/macaron.v1"
|
||
"github.com/ouqiang/cron-scheduler/routers/install"
|
||
"github.com/go-macaron/binding"
|
||
)
|
||
|
||
// 路由注册
|
||
func Register(m *macaron.Macaron) {
|
||
// 所有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)
|
||
})
|
||
} |