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) }
func getDependency(m *martini.Martini, i interface{}) interface{} { return m.Get(inject.InterfaceOf(i)).Interface() }
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) }
func (m *SessionMiddleware) Setup(martini *martini.Martini) { martini.Use(m.ResolveSessionCookie) go m.cleanup() }
// 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)) }) }
// MapDatabase maps the database in Martini func MapDatabase(m *martini.Martini, config *DoorbotConfig) { m.Map(initDatabase(config)) }