当前位置: 首页>>代码示例>>Golang>>正文


Golang ClassicMartini.Post方法代码示例

本文整理汇总了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)
}
开发者ID:malston,项目名称:pezauth,代码行数:33,代码来源:routes.go

示例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)
}
开发者ID:nghiangodinh,项目名称:sample-go-webapp,代码行数:7,代码来源:routes.go

示例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)
}
开发者ID:joshk,项目名称:hustle,代码行数:7,代码来源:http_server.go

示例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)

}
开发者ID:lg0491986,项目名称:pando-cloud,代码行数:29,代码来源:router.go

示例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)

}
开发者ID:lihex,项目名称:vim-tips-web,代码行数:33,代码来源:routers.go

示例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)
}
开发者ID:nquinlan,项目名称:contribot,代码行数:7,代码来源:utils.go

示例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)
}
开发者ID:0-T-0,项目名称:orchestrator,代码行数:29,代码来源:web.go

示例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)
	})
}
开发者ID:johnnywww,项目名称:swd,代码行数:29,代码来源:routeUserDelete.go

示例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)

}
开发者ID:oskycar,项目名称:pando-cloud,代码行数:9,代码来源:router.go

示例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)
}
开发者ID:leisunstar,项目名称:hxs,代码行数:9,代码来源:routers.go

示例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", "")
	})
}
开发者ID:jijeshmohan,项目名称:martini-spike,代码行数:11,代码来源:routes.go

示例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)
}
开发者ID:xrstf,项目名称:raziel,代码行数:11,代码来源:user.go

示例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)
}
开发者ID:kurtinlane,项目名称:submarine,代码行数:11,代码来源:keys-service.go

示例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)
}
开发者ID:tartaruszen,项目名称:dbstream,代码行数:12,代码来源:util.go

示例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("")
	})
}
开发者ID:johnnywww,项目名称:swd,代码行数:12,代码来源:routeServerConfigSave.go


注:本文中的github.com/go-martini/martini.ClassicMartini.Post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。