本文整理汇总了Golang中github.com/go-martini/martini.ClassicMartini.Post方法的典型用法代码示例。如果您正苦于以下问题:Golang ClassicMartini.Post方法的具体用法?Golang ClassicMartini.Post怎么用?Golang ClassicMartini.Post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/go-martini/martini.ClassicMartini
的用法示例。
在下文中一共展示了ClassicMartini.Post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: SetupRoutes
func SetupRoutes(m *martini.ClassicMartini) {
m.Get("/", Leaderboard)
m.Get("/leaders", GetLeaders)
m.Get("/leaders/:page", GetLeaders)
m.Get("/leader/:name", GetLeader)
m.Post("/leader", binding.Json(Leader{}), binding.ErrorHandler, PostLeader)
}
示例3: setupRoutes
func (srv *httpServer) setupRoutes(m *martini.ClassicMartini) {
m.Get(`/`, func() string { return "every day" })
m.Get(`/pusher/info`, srv.getPusherInfo)
m.Post(`/apps/:app_id/events`, binding.Json(Event{}), srv.createAppEvents)
m.Get(`/timeline/:id`, handleStatsJSONP)
log.Printf("Set up HTTP Server routes on %#v\n", m)
}
示例4: route
// martini router
func route(m *martini.ClassicMartini) {
// find a device by key
m.Get("/application/v1/device/info", GetDeviceInfoByKey)
// find a device by identifier
m.Get("/application/v1/devices/:identifier/info", ApplicationAuthOnDeviceIdentifer, GetDeviceInfoByIdentifier)
// get devie current status
m.Get("/application/v1/devices/:identifier/status/current",
ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
GetDeviceCurrentStatus)
// get devie latest status
m.Get("/application/v1/devices/:identifier/status/latest",
ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
GetDeviceLatestStatus)
// set device status
m.Put("/application/v1/devices/:identifier/status",
ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
SetDeviceStatus)
// send a command to device
m.Post("/application/v1/devices/:identifier/commands",
ApplicationAuthOnDeviceIdentifer, CheckDeviceOnline, CheckProductConfig,
SendCommandToDevice)
}
示例5: 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)
}
示例6: mapRoutes
func mapRoutes(m *martini.ClassicMartini) {
m.Post("/githook", handleGitHook)
m.Get("/auth", authGitHub)
m.Get("/githubAuth", gitHubAuthMiddleware, getUserFromToken)
m.Get("/award", gandalf, awardUser)
m.Post("/submission", gandalf, csrf.Validate, handleSubmission)
}
示例7: RegisterDebug
// RegisterDebug adds handlers for /debug/vars (expvar) and /debug/pprof (net/http/pprof) support
func (this *HttpWeb) RegisterDebug(m *martini.ClassicMartini) {
m.Get("/debug/vars", func(w http.ResponseWriter, r *http.Request) {
// from expvar.go, since the expvarHandler isn't exported :(
w.Header().Set("Content-Type", "application/json; charset=utf-8")
fmt.Fprintf(w, "{\n")
first := true
expvar.Do(func(kv expvar.KeyValue) {
if !first {
fmt.Fprintf(w, ",\n")
}
first = false
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
})
fmt.Fprintf(w, "\n}\n")
})
// list all the /debug/ endpoints we want
m.Get("/debug/pprof", pprof.Index)
m.Get("/debug/pprof/cmdline", pprof.Cmdline)
m.Get("/debug/pprof/profile", pprof.Profile)
m.Get("/debug/pprof/symbol", pprof.Symbol)
m.Post("/debug/pprof/symbol", pprof.Symbol)
m.Get("/debug/pprof/block", pprof.Handler("block").ServeHTTP)
m.Get("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
m.Get("/debug/pprof/goroutine", pprof.Handler("goroutine").ServeHTTP)
m.Get("/debug/pprof/threadcreate", pprof.Handler("threadcreate").ServeHTTP)
}
示例8: Routes
func (routeUserDelete *RouteUserDelete) Routes(m *martini.ClassicMartini) {
m.Post("/user/delete", func(w http.ResponseWriter, r *http.Request) string {
log.WriteLog("addr: /user/delete")
SetResponseJsonHeader(w)
setupInfo := model.SetupInfo{}
setupHandle := model.NewSetupHandle()
if !setupHandle.GetSetupInfo(&setupInfo) {
return model.GetErrorDtoJson("读取用户信息失败")
}
r.ParseForm()
log.WriteLog("user delete %v", r.Form)
userName := r.Form.Get("username")
if common.USER_NAME_ADMIN == userName {
log.WriteLog("删除admin失败")
return model.GetErrorDtoJson("删除管理员信息失败")
}
if !setupInfo.DeleteUserByUserName(userName) {
log.WriteLog("删除用户信息失败")
return model.GetErrorDtoJson("删除用户信息失败")
}
if !setupHandle.SaveSetupInfo(&setupInfo) {
log.WriteLog("保存删除用户信息失败")
return model.GetErrorDtoJson("保存删除用户信息失败")
}
return model.GetDataDtoJson(nil)
})
}
示例9: route
// martini router
func route(m *martini.ClassicMartini) {
// regist a device
m.Post("/v1/devices/registration", binding.Json(DeviceRegisterArgs{}), RegisterDevice)
// auth device
// m.Post("v1/devices/authentication", binding.Json(DeviceAuthArgs{}), actions.AuthDevice)
}
示例10: Router
func Router(m *martini.ClassicMartini) {
m.Get("/", controller.Index)
m.Get("/upload_records", controller.UploadRecords)
m.Post("/upload_records", controller.UploadRecords)
m.Get("/choose/exam", controller.ChooseExam)
//答题
m.Get("/answer", controller.Answer)
m.Post("/answer", controller.Answer)
}
示例11: 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", "")
})
}
示例12: 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)
}
示例13: RegisterWebService
func RegisterWebService(server *martini.ClassicMartini) {
path := "/api/v1/keys"
server.Get(path, Get)
//server.Get(path+"/:email", Get)
server.Post(path, Post)
server.Delete(path, Delete)
server.Delete(path+"/:id", Delete)
}
示例14: RegisterRESTFunction
func RegisterRESTFunction(f RESTFunction, cm *martini.ClassicMartini) {
path := f.GetPath()
cm.Get(path, f.RGet)
cm.Get(path+"/:id", f.RGet)
cm.Post(path, f.RPost)
cm.Post(path+"/:id", f.RPost)
cm.Delete(path, f.RDelete)
cm.Delete(path+"/:id", f.RDelete)
}
示例15: Routes
func (routeServerConfigSave *routeServerConfigSave) Routes(m *martini.ClassicMartini) {
m.Post("/server/saveconfig", func(w http.ResponseWriter, r *http.Request, re render.Render) string {
log.WriteLog("addr: /server/saveconfig")
shttp.SetResponseJsonHeader(w)
r.ParseForm()
err := service.NewServerConfigSaveRequestHandle().Save(r)
if nil != err {
return model.GetErrorObjDtoJson(err)
}
return model.GetDataDtoJson("")
})
}