gocron/routers/routers.go

30 lines
672 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 (
"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)
})
}