本文整理汇总了Golang中github.com/go-martini/martini.ClassicMartini.NotFound方法的典型用法代码示例。如果您正苦于以下问题:Golang ClassicMartini.NotFound方法的具体用法?Golang ClassicMartini.NotFound怎么用?Golang ClassicMartini.NotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/go-martini/martini.ClassicMartini
的用法示例。
在下文中一共展示了ClassicMartini.NotFound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InitRoutes
func InitRoutes(m *martini.ClassicMartini) {
m.Get("/", ListBlogs)
m.Get("/new", NewBlog)
m.Post("/new", binding.Form(models.Post{}), CreateBlog)
m.Get("/post/:id", ShowBlog)
m.NotFound(func(r render.Render) {
fmt.Println("....................................................")
r.HTML(404, "status/404", "")
})
}
示例2: Configure
func Configure(m *martini.ClassicMartini) {
m.Group("/humidity", func(r martini.Router) {
r.Post("", humidity.Post)
r.Get("", humidity.Get)
})
m.Get("/current/humidity", current_humidity.Get)
m.Group("/", func(r martini.Router) {
r.Get("", index.Get)
})
static := martini.Static("templates", martini.StaticOptions{Fallback: "/index.tmpl", Exclude: "/api/v"})
m.NotFound(static, http.NotFound)
m.Use(martini.Static("static"))
}
示例3: InitRoutes
func InitRoutes(m *martini.ClassicMartini) {
m.Group("/devices", func(r martini.Router) {
r.Get("", ListDevices)
r.Post("", binding.Form(models.Device{}), CreateDevice)
r.Get("/new", NewDevice)
// r.Get("/:id", ShowDevice)
})
m.Get("/sock", Socket)
m.Get("/node", Node)
m.NotFound(func(r render.Render) {
r.HTML(404, "status/404", "")
})
}
示例4: Routes
func (routeNotFound *RouteNotFound) Routes(m *martini.ClassicMartini) {
m.NotFound(func(w http.ResponseWriter, r *http.Request, re render.Render) {
re.HTML(200, "error", nil)
})
}