• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang web.Post函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中web.Post函数的典型用法代码示例。如果您正苦于以下问题:Golang Post函数的具体用法?Golang Post怎么用?Golang Post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Post函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	config = loadConfig()
	initMongo()
	initLayout()
	h = new(session.MHandler)
	h.SetSession(mSession)
	web.Config.StaticDir = config.Get("staticdir")
	web.Get("/", index)
	web.Get("/post/list", listPosts)
	web.Get("/post/([A-Za-z0-9]+)", readPost)
	web.Get("/page/([a-z0-9\\-]+)\\.html", readPage)
	web.Get("/admin", adminIndexGet)
	web.Get("/admin/post/new", newPostGet)
	web.Post("/admin/post/new", newPostPost)
	web.Get("/admin/post/list", listPost)
	web.Get("/admin/post/edit/(.*)", editPostGet)
	web.Post("/admin/post/edit/(.*)", editPostPost)
	web.Get("/admin/post/del/(.*)", delPost)
	web.Get("/admin/login", adminLoginGet)
	web.Post("/admin/login", adminLoginPost)
	web.Get("/admin/page/new", adminNewPageGet)
	web.Post("/admin/page/new", adminNewPagePost)
	web.Get("/admin/page/list", adminListPagesGet)
	web.Get("/admin/page/edit/(.*)", adminEditPageGet)
	web.Post("/admin/page/edit/(.*)", adminEditPagePost)
	web.Get("/admin/page/del/(.*)", adminDelPage)
	web.Run(config.Get("host") + ":" + config.Get("port"))
}
开发者ID:Quasimo,项目名称:bloody.go,代码行数:28,代码来源:bloody.go


示例2: main

func main() {
	starter.Start()
	web.Config.StaticDir = "web-app/"
	web.Post("/(.*)", starter.Get)
	web.Get("/(.*)", starter.Get)
	web.Run("0.0.0.0:8080")
}
开发者ID:noppanit,项目名称:gon,代码行数:7,代码来源:main.go


示例3: TestMain

func TestMain(t *testing.T) {

	web.Post("/(.*)/(.*)", hello)

	//m2go.Run("tcp://127.0.0.1:9555|tcp://127.0.0.1:9556|54c6755b-9628-40a4-9a2d-cc82a816345e")

}
开发者ID:araddon,项目名称:m2go,代码行数:7,代码来源:m2go_test.go


示例4: RegisterHandlers

// prefix should be something like "/" or "/wiki/"
func RegisterHandlers(prefix string) {
	urlPrefix = prefix
	web.Get(urlPrefix, func(ctx *web.Context) { redirect(ctx, "view", "FrontPage") })
	web.Get(urlPrefix+"view/(.+)", viewHandler)
	web.Get(urlPrefix+"edit/(.+)", editHandler)
	web.Post(urlPrefix+"save/(.+)", saveHandler)
	web.Get(urlPrefix+"cancel/(.+)", cancelHandler)
}
开发者ID:bmatsuo,项目名称:gowiki,代码行数:9,代码来源:handler.go


示例5: main

func main() {
	viewInit()
	mysqlInit()

	web.Get("/edit/(.*)", edit)
	web.Get("/(.*)", show)
	web.Post("/(.*)", update)
	web.Run("0.0.0.0:1111")
}
开发者ID:bketelsen,项目名称:simple_go_wiki,代码行数:9,代码来源:controller.go


示例6: main

func main() {
	m = monitor.NewMonitor(maxQuery, defaultTick)
	web.Post("/dcb/submit", addSub)
	web.Get("/dcb/", listSub)
	web.Get("/dcb/list", listSub)
	web.Get(`/dcb/remove/(.*)`, removeSub)
	web.RunFcgi("127.0.0.1:9006")
	//web.Run("127.0.0.1:9002")
}
开发者ID:gaxxx,项目名称:funx,代码行数:9,代码来源:dcb.go


示例7: main

func main() {
	web.Get("/said", func() string { return tmpl })
	web.Post("/say", func(ctx *web.Context) string {
		input = ctx.Request.Form["said"][0]
		return `<a href="/final">Click Here</a>`
	})
	web.Get("/final", func() string { return "You said " + input })
	web.Run("0.0.0.0:9999")
}
开发者ID:tjweir,项目名称:web.go,代码行数:9,代码来源:arcchallenge.go


示例8: RunWebServer

func RunWebServer(line *util.ChannelLine) {
	util.WebOut = line
	web.SetLogger(log.New(new(dummy), "", 0))
	web.Config.CookieSecret = util.Settings.CookieSecret()
	web.Get("/Liberator/(.*)", get)
	web.Get("/(.*)", index)
	web.Post("/Liberator/(.*)", post)
	web.Run("0.0.0.0:" + strconv.Uitoa(util.Settings.WebPort()))
}
开发者ID:gtalent,项目名称:LiberatorAdventures,代码行数:9,代码来源:web.go


示例9: main

func main() {
	Db = NewMongoDB()
	Db.Connect()
	web.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd"
	web.Get("/", index)
	web.Get("/post", post)

	web.Get("/rss.xml", rss)
	web.Get("/index.php/feed/", rss)
	web.Get("/index.php/feed/atom/", rss)

	web.Get("/admin/edit", editGet)
	web.Post("/admin/edit", editPost)

	web.Get("/admin", adminGet)
	web.Post("/admin", adminPost)

	web.Run("0.0.0.0:9876")

}
开发者ID:andradeandrey,项目名称:fettemama,代码行数:20,代码来源:main.go


示例10: main

func main() {
	/*setup redis connection*/
	redisClient.Addr = "localhost:6379"
	redisClient.Db = 13

	/*setup web.go stuff*/
	web.Get("/", index)
	web.Get("/s/(.*)", show)
	web.Get("/u/(.*)", redirect)
	web.Post("/shorten", shorten)
	web.Run("0.0.0.0:8080")
}
开发者ID:hernan43,项目名称:gourl,代码行数:12,代码来源:gourl.go


示例11: main

func main() {

	conn := need_connection()
	var p Personne
	var c Car
	Personnes := gouda.M(p)
	Cars := gouda.M(c)
	Cars.BelongsToKey(Personnes, "owner", "Owner_id")
	Personnes.HasManyKey(Cars, "cars", "Owner_id")

	//web.Get("/(.*)", hello)
	web.Get("/new_person/", new_person)
	web.Get("/persons/", persons)
	web.Get("/", persons)
	web.Get("/person/(.*)", person_detail)
	web.Get("/edit_person/(.*)", person_edit)
	web.Get("/delete_person/(.*)", person_delete)
	web.Post("/person", create_person)
	web.Post("/update_person", update_person)
	web.Run("0.0.0.0:9999")
	conn.Close()
}
开发者ID:zetaben,项目名称:gouda,代码行数:22,代码来源:sample_web_app.go


示例12: main

func main() {
	flag.Parse()
	Init(NewDiskvStore(*dir, uint32(*maxsz)), *pwhash)
	log.Printf("nobodycares engine starting up...")

	web.Get("/", get_root)
	web.Get("/from/([0-9a-f]+)", get_from)
	web.Get("/post", get_post)
	web.Get("/edit/([0-9a-f]+)", get_edit)
	web.Get("/([0-9a-f]+)/edit", get_edit)
	web.Get("/delete/([0-9a-f]+)", get_delete)
	web.Get("/([0-9a-f]+)/delete", get_delete)
	web.Get("/([0-9a-f]+)", get_specific_id)
	web.Get("/rss", get_rss)
	web.Get("/css/(.*)", get_css)

	web.Post("/post", post_post)
	web.Post("/edit", post_edit)
	web.Post("/delete", post_delete)

	web.Run(fmt.Sprintf("%s:%d", *host, *port))
}
开发者ID:tengteng,项目名称:nobodycares,代码行数:22,代码来源:nobodycares.go


示例13: main

func main() {
	rand.Seed(time.Nanoseconds())
	web.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd"
	web.Get("/said", func() string { return form })
	web.Post("/say", func(ctx *web.Context) string {
		uid := strconv.Itoa64(rand.Int63())
		ctx.SetSecureCookie("user", uid, 3600)
		users[uid] = ctx.Request.Params["said"]
		return `<a href="/final">Click Here</a>`
	})
	web.Get("/final", func(ctx *web.Context) string {
		uid, _ := ctx.GetSecureCookie("user")
		return "You said " + users[uid]
	})
	web.Run("0.0.0.0:9999")
}
开发者ID:noppanit,项目名称:web.go,代码行数:16,代码来源:arcchallenge.go


示例14: main

func main() {
	fmt.Printf("start\n")
	out, err := ioutil.ReadFile("./index.php")
	if err != nil {
		return
	}
	s := string(out)
	hello := func() string {
		return s
	}
	web.Get("/", hello)
	web.Get("/dnd/dnd.go", hello)
	web.Post("/dnd/dnd.go", bye)
	web.RunFcgi("127.0.0.1:9001")
	//web.Run("0.0.0.0:9000")
}
开发者ID:gaxxx,项目名称:funx,代码行数:16,代码来源:dnd.go


示例15: main

func main() {
	config = loadConfig()
	initMongo()
	initLayout()
	h = new(session.MHandler)
	h.SetSession(mSession)
	blogConfig = PreferenceInit()
	path, _ := os.Getwd()
	web.Config.StaticDir = path + "/" + config.Get("staticdir")
	i := &Index{}
	a := &Admin{}
	web.Get("/", web.MethodHandler(i, "Index"))
	web.Get("/post/list", web.MethodHandler(i, "ListPosts"))
	web.Get("/post/([A-Za-z0-9]+)", web.MethodHandler(i, "ReadPost"))
	web.Get("/page/([a-z0-9\\-]+)\\.html", web.MethodHandler(i, "ReadPage"))
	web.Post("/post/([A-Za-z0-9]+)/comment/new", web.MethodHandler(i, "NewComment"))
	web.Get("/admin", web.MethodHandler(a, "IndexGet"))
	web.Get("/admin/preferences", web.MethodHandler(a, "PreferencesGet"))
	web.Post("/admin/preferences", web.MethodHandler(a, "PreferencesPost"))
	web.Get("/admin/post/new", web.MethodHandler(a, "NewPostGet"))
	web.Post("/admin/post/new", web.MethodHandler(a, "NewPostPost"))
	web.Get("/admin/post/list", web.MethodHandler(a, "ListPost"))
	web.Post("/admin/post/list", web.MethodHandler(a, "BulkActions"))
	web.Get("/admin/post/edit/(.*)", web.MethodHandler(a, "EditPostGet"))
	web.Post("/admin/post/edit/(.*)", web.MethodHandler(a, "EditPostPost"))
	web.Get("/admin/post/del/(.*)", web.MethodHandler(a, "DelPost"))
	web.Get("/admin/login", web.MethodHandler(a, "LoginGet"))
	web.Post("/admin/login", web.MethodHandler(a, "LoginPost"))
	web.Get("/admin/page/new", web.MethodHandler(a, "NewPageGet"))
	web.Post("/admin/page/new", web.MethodHandler(a, "NewPagePost"))
	web.Get("/admin/page/list", web.MethodHandler(a, "ListPagesGet"))
	web.Get("/admin/page/edit/(.*)", web.MethodHandler(a, "EditPageGet"))
	web.Post("/admin/page/edit/(.*)", web.MethodHandler(a, "EditPagePost"))
	web.Get("/admin/page/del/(.*)", web.MethodHandler(a, "DelPage"))
	web.Get("/admin/comment/del/(.*)/(.*)", web.MethodHandler(a, "DelComment"))
	web.Get("/admin/bloody/restart", web.MethodHandler(a, "RestartBloody"))
	web.Get("/rss", web.MethodHandler(i, "RSS"))
	web.Run(config.Get("host") + ":" + config.Get("port"))
}
开发者ID:JessonChan,项目名称:bloody.go,代码行数:39,代码来源:bloody.go


示例16: bootstrap

// bootstraps the server
func bootstrap(path string) os.Error {
	config = NewConfig(path)
	config.Parse()

	host := config.GetStringDefault("redis.address", "tcp:localhost:6379")
	db := config.GetIntDefault("redis.database", 0)
	passwd := config.GetStringDefault("redis.password", "")

	redis = godis.New(host, db, passwd)

	web.Config.StaticDir = config.GetStringDefault("static-directory", "")

	web.Post("/shorten/(.*)", shorten)
	// support for Get makes it easier to implement a bookmarklet
	web.Get("/shorten/(.*)", shorten)

	web.Get("/", index)
	web.Get("/([a-zA-Z0-9]*)", resolve)
	web.Get("/([a-zA-Z0-9]*)\\+", info)
	web.Get("/latest/([0-9]*)", latest)
	web.Get("/info/([a-zA-Z0-9]*)", info)

	return nil
}
开发者ID:vormplus,项目名称:kurz.go,代码行数:25,代码来源:kurz.go


示例17: main

func main() {
	web.Get("/", index)
	web.Post("/multipart", multipart)
	web.Run("0.0.0.0:9999")
}
开发者ID:iamnafets,项目名称:web.go,代码行数:5,代码来源:multipart.go


示例18: main

func main() {
	web.Get("/", index)
	web.Post("/update", update)
	web.Run("0.0.0.0:9999")
}
开发者ID:rcoh,项目名称:modata,代码行数:5,代码来源:cookie.go


示例19: main

func main() {
	web.Get("/", index)
	web.Post("/process", process)
	web.Run("0.0.0.0:9999")
}
开发者ID:noppanit,项目名称:web.go,代码行数:5,代码来源:params.go


示例20: Post

func Post(route string, handler func(*Action, []string)) {
	web.Post(route, ctxHandler(handler))
}
开发者ID:nono,项目名称:Goldorak.Go,代码行数:3,代码来源:action.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang web.Run函数代码示例发布时间:2022-05-28
下一篇:
Golang web.Get函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap