当前位置: 首页>>代码示例>>Golang>>正文


Golang ClassicMartini.NotFound方法代码示例

本文整理汇总了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", "")
	})
}
开发者ID:jijeshmohan,项目名称:martini-spike,代码行数:11,代码来源:routes.go

示例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"))
}
开发者ID:oroshnivskyy,项目名称:FlowerPotServer,代码行数:15,代码来源:routes.go

示例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", "")
	})
}
开发者ID:jijeshmohan,项目名称:mtgrid,代码行数:15,代码来源:routes.go

示例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)
	})
}
开发者ID:johnnywww,项目名称:swd,代码行数:5,代码来源:routeError.go


注:本文中的github.com/go-martini/martini.ClassicMartini.NotFound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。