Exemple #1
0
func Routes(m *martini.Martini) {
	r := martini.NewRouter()

	r.Get(`/`, controllers.Index)
	r.Get(`/hello`, middlewares.ApiVerify(), controllers.Hello)

	// Add the router action
	m.Action(r.Handle)
}
Exemple #2
0
func configureServer(server *martini.Martini, router martini.Router) {
	server.Use(martini.Recovery())
	server.Use(middleware.Logger())
	server.Use(martini.Static("templates/public", martini.StaticOptions{SkipLogging: true}))
	server.Use(martini.Static("templates/images", martini.StaticOptions{Prefix: "images", SkipLogging: true}))
	server.Use(martini.Static("templates/styles", martini.StaticOptions{Prefix: "styles", SkipLogging: true}))
	server.Use(martini.Static("templates/scripts", martini.StaticOptions{Prefix: "scripts", SkipLogging: true}))
	server.Use(render.Renderer(render.Options{
		Layout: "layout",
	}))
	server.MapTo(router, (*martini.Routes)(nil))
	server.Action(router.Handle)
}