gocron/routers/routers.go

31 lines
752 B
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package routers
import (
"github.com/go-macaron/binding"
"github.com/ouqiang/cron-scheduler/routers/install"
"gopkg.in/macaron.v1"
)
// 路由注册
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)
})
}