本文整理匯總了Golang中github.com/go-martini/martini.ClassicMartini.Group方法的典型用法代碼示例。如果您正苦於以下問題:Golang ClassicMartini.Group方法的具體用法?Golang ClassicMartini.Group怎麽用?Golang ClassicMartini.Group使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/go-martini/martini.ClassicMartini
的用法示例。
在下文中一共展示了ClassicMartini.Group方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Mount
func Mount(m *martini.ClassicMartini, concurrent int) {
fmt.Println("concurrent @v:", concurrent)
m.Use(utee.MidConcurrent(concurrent))
m.Use(render.Renderer())
m.Use(utee.MidTextDefault)
// //map request web utilities
m.Use(func(w http.ResponseWriter, c martini.Context) {
web := &utee.Web{W: w}
c.Map(web)
})
m.Use(func(c martini.Context){
var msgs []string
for i:=0;i<100000;i++ {
msgs = append(msgs,fmt.Sprint("testMsg",i))
}
c.Map(msgs)
})
m.Group("/hello", func(r martini.Router) {
r.Post("/world", test)
r.Get("/world", test)
})
http.Handle("/", m)
// http.HandleFunc("/test/a", testhandler)
}
示例2: InitRouters
func InitRouters(m *martini.ClassicMartini) {
//Routers for front pages
m.Get("/", HandleIndex)
m.Get("/tips/:Id", HandleTip)
m.Get("/random_tips/txt", HandleRandomTxtTip)
m.Get("/random_tips/json", HandleRandomJsonTip)
m.Get("/casts", paginate.Handler, HandleCasts)
m.Get("/casts/:Id", ShowCast)
m.Get("/api", HandleAPI)
m.Get("/tools", HandleTools)
m.Get("/about", HandleAbout)
m.Get("/admin/login", ShowLoginPage)
m.Get("/admin/logout", HandleLogout)
m.Post("/admin/login", HandleLogin)
//Routers for admin panel
m.Group("/admin", func(r martini.Router) {
r.Get("/index", HandleAdminIndex)
r.Get("/tips", paginate.Handler, AdminShowTips)
r.Post("/tips/add", AdminAddTips)
r.Post("/tips/del", AdminDelTips)
r.Post("/tips/update", AdminModifyTips)
r.Get("/casts", paginate.Handler, AdminShowCasts)
r.Get("/password", AdminPassword)
r.Post("/password", AdminUpdatePassword)
r.Get("/casts/add", AdminAddCastsPage)
r.Post("/casts", AdminAddCasts)
r.Post("/casts/del", AdminDelCasts)
r.Post("/casts/modify", AdminUpdateCasts)
r.Get("/casts/modify/:Id", AdminModifyCasts)
}, validateSession)
}
示例3: InitRoutes
//InitRoutes - initialize the mappings for controllers against valid routes
func InitRoutes(m *martini.ClassicMartini, redisConn Doer, mongoConn pezdispenser.MongoCollectionGetter, authClient AuthRequestCreator) {
setOauthConfig()
keyGen := NewKeyGen(redisConn, &GUIDMake{})
m.Use(render.Renderer())
m.Use(martini.Static(StaticPath))
m.Use(oauth2.Google(OauthConfig))
authKey := NewAuthKeyV1(keyGen)
m.Get("/info", authKey.Get())
m.Get(ValidKeyCheck, NewValidateV1(keyGen).Get())
m.Get("/me", oauth2.LoginRequired, DomainCheck, NewMeController().Get())
m.Get("/", oauth2.LoginRequired, DomainCheck, func(params martini.Params, log *log.Logger, r render.Render, tokens oauth2.Tokens) {
userInfo := GetUserInfo(tokens)
r.HTML(SuccessStatus, "index", userInfo)
})
m.Post("/sandbox", oauth2.LoginRequired, DomainCheck, NewSandBoxController().Post())
m.Group(URLAuthBaseV1, func(r martini.Router) {
r.Put(APIKey, authKey.Put())
r.Get(APIKey, authKey.Get())
r.Delete(APIKey, authKey.Delete())
}, oauth2.LoginRequired, DomainCheck)
m.Group(URLOrgBaseV1, func(r martini.Router) {
pcfOrg := NewOrgController(mongoConn, authClient)
r.Put(OrgUser, pcfOrg.Put())
r.Get(OrgUser, pcfOrg.Get())
}, oauth2.LoginRequired, DomainCheck)
}
示例4: controller
//controller轉發規則設置
func controller(m *martini.ClassicMartini) { // {{{
m.Get("/", func(r render.Render) {
r.HTML(200, "index", nil)
})
m.Group("/schedules", func(r martini.Router) {
//Schedule部分
r.Get("", GetSchedules)
r.Post("", binding.Bind(schedule.Schedule{}), AddSchedule)
r.Get("/:id", GetScheduleById)
r.Put("/:id", binding.Bind(schedule.Schedule{}), UpdateSchedule)
r.Delete("/:id", DeleteSchedule)
//Job部分
r.Get("/:sid/jobs", GetJobsForSchedule)
r.Post("/:sid/jobs", binding.Bind(schedule.Job{}), AddJob)
r.Put("/:sid/jobs/:id", binding.Bind(schedule.Job{}), UpdateJob)
r.Delete("/:sid/jobs/:id", DeleteJob)
//Task部分
r.Post("/:sid/jobs/:jid/tasks", binding.Bind(schedule.Task{}), AddTask)
r.Put("/:sid/jobs/:jid/tasks/:id", binding.Bind(schedule.Task{}), UpdateTask)
r.Delete("/:sid/jobs/:jid/tasks/:id", DeleteTask)
//TaskRelation部分
r.Post("/:sid/jobs/:jid/tasks/:id/reltask/:relid", AddRelTask)
r.Delete("/:sid/jobs/:jid/tasks/:id/reltask/:relid", DeleteRelTask)
})
} // }}}
示例5: RouterSiginInit
func RouterSiginInit(m *martini.ClassicMartini) {
m.Group("/sign", func(r martini.Router) {
r.Get("/in", SignIn)
r.Post("/in/todo", SignInTodo)
r.Get("/up", SignUp)
r.Post("/up/todo", SignUpTodo)
})
}
示例6: RouterUserInit
func RouterUserInit(m *martini.ClassicMartini) {
m.Group("/user", func(r martini.Router) {
r.Get("/list", ListUser)
r.Get("/upd/:id", UpdUser)
r.Post("/upd/todo", UpdUserTodo)
r.Get("/del/:id", DelUser)
}, middlewares.Auth())
}
示例7: SetupRoutes
func SetupRoutes(db *mgo.Database, m *martini.ClassicMartini) {
m.Group("/oauth", func(r martini.Router) {
r.Get("/register/:type", modules.Register)
r.Get("/github", binding.Bind(models.GithubOAuth{}), modules.GithubOAuth)
})
m.Group("/api/user", func(r martini.Router) {
r.Put("/", binding.Bind(models.User{}), api.RegisterUser)
})
}
示例8: RoutePage
func RoutePage(m *martini.ClassicMartini) {
m.Group("/appmanager", func(r martini.Router) {
r.Get("", page_index)
r.Get("/channel/list", page_channel_list)
r.Get("/version/add", page_version_add)
r.Get("/channel/add", page_channel_add)
r.Post("/version/add", version_add)
r.Post("/channel/add/submit", binding.Bind(ChannelAddForm{}), channel_add)
})
}
示例9: setupUsersCtrl
func setupUsersCtrl(app *martini.ClassicMartini) {
app.Group("/users", func(r martini.Router) {
app.Get("", usersIndexAction)
app.Get("/add", usersAddAction)
app.Post("", sessions.RequireCsrfToken, usersCreateAction)
app.Get("/:id", usersEditAction)
app.Put("/:id", sessions.RequireCsrfToken, usersUpdateAction)
app.Delete("/:id", sessions.RequireCsrfToken, usersDeleteAction)
app.Get("/:id/delete", usersDeleteConfirmAction)
}, sessions.RequireLogin)
}
示例10: mapRoutes
func mapRoutes(server *martini.ClassicMartini) {
server.Get("/", controller.Home)
server.Group("/api", func(apiRoutes martini.Router) {
apiRoutes.Get("/pages", api.PageIndex)
apiRoutes.Get("/pages/:id", api.PageShow)
apiRoutes.Group("/pages/:pageId", func(pageRoutes martini.Router) {
pageRoutes.Get("/posts", api.PostIndex)
})
})
}
示例11: setupConsumersCtrl
func setupConsumersCtrl(app *martini.ClassicMartini) {
app.Group("/consumers", func(r martini.Router) {
app.Get("", consumersIndexAction)
app.Get("/add", consumersAddAction)
app.Post("", sessions.RequireCsrfToken, consumersCreateAction)
app.Get("/:id", consumersEditAction)
app.Put("/:id", sessions.RequireCsrfToken, consumersUpdateAction)
app.Delete("/:id", sessions.RequireCsrfToken, consumersDeleteAction)
app.Get("/:id/delete", consumersDeleteConfirmAction)
app.Get("/:id/urls", consumersUrlsAction)
}, sessions.RequireLogin)
// public
app.Get("/info/:consumer/:token", consumerInfoAction)
}
示例12: 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", "")
})
}
示例13: 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"))
}
示例14: Register
func Register(m *martini.ClassicMartini) {
m.Get("/ruok", Ruok)
m.Any("/", Home)
m.Any("/doc", Doc)
m.Any("/repo", Repo)
m.Any("/history", History)
m.Any("/download", Download)
m.Post("/new-repo", binding.Bind(RepoInfoForm{}), NewRepo)
m.Any("/search", Search)
m.Group("/api", func(r martini.Router) {
m.Get("/pkglist", PkgList)
m.Post("/build", binding.Bind(RepositoryForm{}), NewBuild)
m.Post("/force-rebuild", binding.Bind(TaskForm{}), ForceRebuild)
})
m.Get("/badge/**", Badge)
m.Get("/**", Repo) // for the rest of request
// Not found handler.
// m.NotFound(routers.NotFound)
}
示例15: InitRoutes
//InitRoutes - initialize the mappings for controllers against valid routes
func InitRoutes(m *martini.ClassicMartini, validationTargetUrl string) {
keyCheckHandler := keycheck.NewAPIKeyCheckMiddleware(validationTargetUrl).Handler()
itemLeaseController := NewLeaseController(APIVersion1, Item)
typeLeaseController := NewLeaseController(APIVersion1, Type)
listLeaseController := NewLeaseController(APIVersion1, List)
lockController := NewLockController(APIVersion1)
m.Group("/", func(r martini.Router) {
r.Get("info", func() string {
return "the dispenser service will give you candy"
})
})
m.Group(URLLeaseBaseV1, func(r martini.Router) {
r.Post(URLTypeGUID, typeLeaseController.Post())
r.Get(URLTypeGUID, typeLeaseController.Get())
r.Post(URLItemGUID, itemLeaseController.Post())
r.Get(URLItemGUID, itemLeaseController.Get())
r.Delete(URLItemGUID, itemLeaseController.Delete())
r.Get(URLLeases, listLeaseController.Get())
}, keyCheckHandler)
m.Group(URLLockBaseV1, func(r martini.Router) {
r.Post(URLItemGUID, lockController.Post())
r.Get(URLItemGUID, lockController.Get())
}, keyCheckHandler)
}