Example #1
0
func (m *SessionMiddleware) Setup(martini *martini.Martini) {
	martini.Use(m.ResolveSessionCookie)

	go m.cleanup()
}
Example #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)
}
Example #3
0
// UseRepositories maps the repositories within a martini context.
func UseRepositories(m *martini.Martini) {

	m.Use(func(c martini.Context, database *gorp.DbMap) {
		c.MapTo(newRepositories(database), (*Repositories)(nil))
	})
}