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

Golang appengine.Main函数代码示例

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

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



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

示例1: main

func main() {
	http.HandleFunc("/call/receive", receiveCallHandler)
	http.HandleFunc("/sms/send", sendSMSHandler)
	http.HandleFunc("/sms/receive", receiveSMSHandler)

	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:7,代码来源:twilio.go


示例2: main

func main() {
	// Serve static files from "static" directory.
	http.Handle("/static/", http.FileServer(http.Dir(".")))

	http.HandleFunc("/", homepageHandler)
	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:7,代码来源:staticfiles.go


示例3: main

func main() {
	// the appengine package provides a convenient method to handle the health-check requests
	// and also run the app on the correct port. We just need to add Echo to the default handler
	e := echo.New(":8080")
	http.Handle("/", e)
	appengine.Main()
}
开发者ID:luizbafilho,项目名称:fusis,代码行数:7,代码来源:app-managed.go


示例4: main

func main() {
	redisAddr := os.Getenv("REDIS_ADDR")
	redisPassword := os.Getenv("REDIS_PASSWORD")

	redisPool = &redis.Pool{
		Dial: func() (redis.Conn, error) {
			conn, err := redis.Dial("tcp", redisAddr)
			if redisPassword == "" {
				return conn, err
			}
			if err != nil {
				return nil, err
			}
			if _, err := conn.Do("AUTH", redisPassword); err != nil {
				conn.Close()
				return nil, err
			}
			return conn, nil
		},
		// TODO: Tune other settings, like IdleTimeout, MaxActive, MaxIdle, TestOnBorrow.
	}

	http.HandleFunc("/", handle)
	appengine.Main()
}
开发者ID:GoogleCloudPlatform,项目名称:golang-samples,代码行数:25,代码来源:redis.go


示例5: main

func main() {
	// the appengine package provides a convenient method to handle the health-check requests
	// and also run the app on the correct port. We just need to add Vodka to the default handler
	s := standard.New(":8080")
	s.SetHandler(e)
	http.Handle("/", s)
	appengine.Main()
}
开发者ID:insionng,项目名称:vodka,代码行数:8,代码来源:app-managed.go


示例6: main

func main() {
	var err error
	api.Tracer, err = trace.NewClient(appengine.BackgroundContext(), "ellies-pad")
	if err != nil {
		panic(err)
	}

	appengine.Main()
}
开发者ID:trythings,项目名称:trythings,代码行数:9,代码来源:main.go


示例7: main

func main() {
	initStorage()

	go restartAbandonedOperations()

	setupHandlers()

	appengine.Main()
}
开发者ID:google,项目名称:git-pull-request-mirror,代码行数:9,代码来源:main.go


示例8: main

func main() {
	ctx := context.Background()

	var err error
	storageClient, err = storage.NewClient(ctx)
	if err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/", formHandler)
	http.HandleFunc("/upload", uploadHandler)

	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:14,代码来源:storage.go


示例9: main

func main() {
	r := mux.NewRouter()

	r.Path("/echo").Methods("POST").
		HandlerFunc(echoHandler)

	r.Path("/auth/info/googlejwt").Methods("GET").
		HandlerFunc(authInfoHandler)
	r.Path("/auth/info/googleidtoken").Methods("GET").
		HandlerFunc(authInfoHandler)

	http.Handle("/", r)
	appengine.Main()
}
开发者ID:jeffmendoza,项目名称:golang-samples,代码行数:14,代码来源:app.go


示例10: main

func main() {
	go http.ListenAndServe(":8090", http.HandlerFunc(ws.Handle))

	http.HandleFunc("/_ah/mail/", controllers.ReceiveMail)
	http.HandleFunc("/cert", hsts(controllers.Certificate))
	http.HandleFunc("/status", hsts(controllers.Status))

	r := mux.NewRouter()
	r.HandleFunc("/subscriptions", hsts(controllers.Subscriptions))

	r.HandleFunc("/code/download", hsts(guard(controllers.Template)))
	r.HandleFunc("/invitations", setup(controllers.Invitation))

	r.HandleFunc("/tokens", setup(controllers.Tokens))
	r.HandleFunc("/tokens/collect", setup(controllers.CollectTokens))

	r.HandleFunc("/challenges", setup(controllers.CreateChallenge))
	r.HandleFunc("/challenges/{key}", setup(controllers.ChallengeByKey))
	r.HandleFunc("/challenges/{key}/results", setup(controllers.GetResultsByChallenge))

	r.HandleFunc("/companies", setup(controllers.PostCompany))
	r.HandleFunc("/companies/{key}/challenges", setup(controllers.GetChallengesForCompany))
	r.HandleFunc("/companies/{key}/users", setup(controllers.GetUsersByCompany))

	r.HandleFunc("/mock", controllers.Mock)

	r.HandleFunc("/profiles/{key}", setup(controllers.GetProfileByKey))
	r.HandleFunc("/profiles/{key}", setup(controllers.DeleteProfile))
	r.HandleFunc("/profiles/{key}/challenges", setup(controllers.GetChallengesForProfile))

	r.HandleFunc("/results", setup(controllers.CreateResult))
	r.HandleFunc("/results/{resultKey}/tasks/{taskKey}/submissions", setup(controllers.PostSubmission))
	r.HandleFunc("/results/{resultKey}/finalSubmissions/{index}", setup(controllers.FinalSubmission))
	r.HandleFunc("/results/{resultKey}", setup(controllers.GetResult))

	r.HandleFunc("/user/company", setup(controllers.GetCompanyByUser))
	r.HandleFunc("/user", setup(controllers.WhoAmI))
	r.HandleFunc("/users", setup(controllers.User))
	r.HandleFunc("/users/{key}", setup(controllers.GetUser))
	r.HandleFunc("/users/{key}/profile", setup(controllers.GetProfileForUser))

	r.HandleFunc("/tasks/{key}", setup(controllers.TaskByKey))
	r.HandleFunc("/tasks", setup(controllers.Tasks))

	r.HandleFunc("/whoami", setup(controllers.WhoAmI))

	http.Handle("/", r)
	appengine.Main()
}
开发者ID:pbochis,项目名称:api,代码行数:49,代码来源:main.go


示例11: main

func main() {
	ctx := context.Background()

	// Set this in app.yaml when running in production.
	projectID := os.Getenv("GCLOUD_DATASET_ID")

	var err error
	datastoreClient, err = datastore.NewClient(ctx, projectID)
	if err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/", handle)
	appengine.Main()
}
开发者ID:GoogleCloudPlatform,项目名称:golang-samples,代码行数:15,代码来源:datastore.go


示例12: main

func main() {
	ctx := context.Background()

	client, err := pubsub.NewClient(ctx, mustGetenv("GCLOUD_PROJECT"))
	if err != nil {
		log.Fatal(err)
	}

	// Create topic if it doesn't exist.
	topic, _ = client.CreateTopic(ctx, mustGetenv("PUBSUB_TOPIC"))

	http.HandleFunc("/", listHandler)
	http.HandleFunc("/pubsub/publish", publishHandler)
	http.HandleFunc("/pubsub/push", pushHandler)

	appengine.Main()
}
开发者ID:GoogleCloudPlatform,项目名称:golang-samples,代码行数:17,代码来源:pubsub.go


示例13: main

func main() {
	host := os.Getenv("MEMCACHE_PORT_11211_TCP_ADDR")
	if host == "" {
		host = "localhost"
	}

	port := os.Getenv("MEMCACHE_PORT_11211_TCP_PORT")
	if port == "" {
		port = "11211"
	}

	addr := fmt.Sprintf("%s:%s", host, port)

	memcacheClient = memcache.New(addr)

	http.HandleFunc("/", handle)
	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:18,代码来源:memcache.go


示例14: main

func main() {
	ctx := context.Background()

	// Set this in app.yaml when running in production.
	projectID := os.Getenv("GCLOUD_PROJECT")
	topic = os.Getenv("PUBSUB_TOPIC")

	var err error
	pubsubCtx, err = pubsubContext(ctx, projectID)
	if err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/", listHandler)
	http.HandleFunc("/pubsub/publish", publishHandler)
	http.HandleFunc("/pubsub/push", pushHandler)

	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:19,代码来源:pubsub.go


示例15: main

func main() {
	// Set this in app.yaml when running in production.
	datastoreName := os.Getenv("MYSQL_CONNECTION")

	var err error
	db, err = sql.Open("mysql", datastoreName)
	if err != nil {
		log.Fatal(err)
	}

	// Ensure the table exists.
	// Running an SQL query also checks the connection to the MySQL server
	// is authenticated and valid.
	if err := createTable(); err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/", handle)
	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:20,代码来源:cloudsql.go


示例16: main

func main() {
	ctx := context.Background()

	// Set up admin client, tables, and column families.
	// NewAdminClient uses Application Default Credentials to authenticate.
	adminClient, err := bigtable.NewAdminClient(ctx, project, instance)
	if err != nil {
		log.Fatalf("Unable to create a table admin client. %v", err)
	}
	tables, err := adminClient.Tables(ctx)
	if err != nil {
		log.Fatalf("Unable to fetch table list. %v", err)
	}
	if !sliceContains(tables, tableName) {
		if err := adminClient.CreateTable(ctx, tableName); err != nil {
			log.Fatalf("Unable to create table: %v. %v", tableName, err)
		}
	}
	tblInfo, err := adminClient.TableInfo(ctx, tableName)
	if err != nil {
		log.Fatalf("Unable to read info for table: %v. %v", tableName, err)
	}
	if !sliceContains(tblInfo.Families, familyName) {
		if err := adminClient.CreateColumnFamily(ctx, tableName, familyName); err != nil {
			log.Fatalf("Unable to create column family: %v. %v", familyName, err)
		}
	}
	adminClient.Close()

	// Set up Bigtable data operations client.
	// NewClient uses Application Default Credentials to authenticate.
	client, err = bigtable.NewClient(ctx, project, instance)
	if err != nil {
		log.Fatalf("Unable to create data operations client. %v", err)
	}

	http.Handle("/", appHandler(mainHandler))
	appengine.Main() // Never returns.
}
开发者ID:rawlingsj,项目名称:gofabric8,代码行数:39,代码来源:main.go


示例17: main

func main() {
	http.HandleFunc("/sendmail", sendMailHandler)

	appengine.Main()
}
开发者ID:wuman,项目名称:golang-samples,代码行数:5,代码来源:sendgrid.go


示例18: main

func main() {
	registerHandlers()
	appengine.Main()
}
开发者ID:jeffmendoza,项目名称:golang-samples,代码行数:4,代码来源:app.go


示例19: init

func init() {
	http.HandleFunc("/", handle)
	appengine.Main()
}
开发者ID:hogedigo,项目名称:shizgo,代码行数:4,代码来源:hellomvms.go


示例20: main


//.........这里部分代码省略.........
	if err := parseTextTemplates([][]string{
		{"cmd.txt", "common.txt"},
		{"dir.txt", "common.txt"},
		{"home.txt", "common.txt"},
		{"notfound.txt", "common.txt"},
		{"pkg.txt", "common.txt"},
		{"results.txt", "common.txt"},
	}); err != nil {
		log.Fatal(err)
	}

	var err error
	db, err = database.New()
	if err != nil {
		log.Fatalf("Error opening database: %v", err)
	}

	go runBackgroundTasks()

	staticServer := httputil.StaticServer{
		Dir:    *assetsDir,
		MaxAge: time.Hour,
		MIMETypes: map[string]string{
			".css": "text/css; charset=utf-8",
			".js":  "text/javascript; charset=utf-8",
		},
	}
	statusImageHandlerPNG = staticServer.FileHandler("status.png")
	statusImageHandlerSVG = staticServer.FileHandler("status.svg")

	apiMux := http.NewServeMux()
	apiMux.Handle("/favicon.ico", staticServer.FileHandler("favicon.ico"))
	apiMux.Handle("/google3d2f3cd4cc2bb44b.html", staticServer.FileHandler("google3d2f3cd4cc2bb44b.html"))
	apiMux.Handle("/humans.txt", staticServer.FileHandler("humans.txt"))
	apiMux.Handle("/robots.txt", staticServer.FileHandler("apiRobots.txt"))
	apiMux.Handle("/search", apiHandler(serveAPISearch))
	apiMux.Handle("/packages", apiHandler(serveAPIPackages))
	apiMux.Handle("/importers/", apiHandler(serveAPIImporters))
	apiMux.Handle("/imports/", apiHandler(serveAPIImports))
	apiMux.Handle("/", apiHandler(serveAPIHome))

	mux := http.NewServeMux()
	mux.Handle("/-/site.js", staticServer.FilesHandler(
		"third_party/jquery.timeago.js",
		"site.js"))
	mux.Handle("/-/site.css", staticServer.FilesHandler("site.css"))
	mux.Handle("/-/bootstrap.min.css", staticServer.FilesHandler("bootstrap.min.css"))
	mux.Handle("/-/bootstrap.min.js", staticServer.FilesHandler("bootstrap.min.js"))
	mux.Handle("/-/jquery-2.0.3.min.js", staticServer.FilesHandler("jquery-2.0.3.min.js"))
	if *sidebarEnabled {
		mux.Handle("/-/sidebar.css", staticServer.FilesHandler("sidebar.css"))
	}
	mux.Handle("/-/", http.NotFoundHandler())

	mux.Handle("/-/about", handler(serveAbout))
	mux.Handle("/-/bot", handler(serveBot))
	mux.Handle("/-/go", handler(serveGoIndex))
	mux.Handle("/-/subrepo", handler(serveGoSubrepoIndex))
	mux.Handle("/-/refresh", handler(serveRefresh))
	mux.Handle("/-/admin/reindex", http.HandlerFunc(runReindex))
	mux.Handle("/-/admin/purgeindex", http.HandlerFunc(runPurgeIndex))
	mux.Handle("/about", http.RedirectHandler("/-/about", http.StatusMovedPermanently))
	mux.Handle("/favicon.ico", staticServer.FileHandler("favicon.ico"))
	mux.Handle("/google3d2f3cd4cc2bb44b.html", staticServer.FileHandler("google3d2f3cd4cc2bb44b.html"))
	mux.Handle("/humans.txt", staticServer.FileHandler("humans.txt"))
	mux.Handle("/robots.txt", staticServer.FileHandler("robots.txt"))
	mux.Handle("/BingSiteAuth.xml", staticServer.FileHandler("BingSiteAuth.xml"))
	mux.Handle("/C", http.RedirectHandler("http://golang.org/doc/articles/c_go_cgo.html", http.StatusMovedPermanently))
	mux.Handle("/code.jquery.com/", http.NotFoundHandler())
	mux.Handle("/_ah/health", http.HandlerFunc(serveHealthCheck))
	mux.Handle("/_ah/", http.NotFoundHandler())
	mux.Handle("/", handler(serveHome))

	cacheBusters.Handler = mux

	var root http.Handler = rootHandler{
		{"api.", apiMux},
		{"talks.godoc.org", otherDomainHandler{"https", "go-talks.appspot.com"}},
		{"www.godoc.org", otherDomainHandler{"https", "godoc.org"}},
		{"", mux},
	}
	if gceLogName != "" {
		ctx := context.Background()

		logc, err := logging.NewClient(ctx, projID)
		if err != nil {
			log.Fatalf("Failed to create cloud logging client: %v", err)
		}
		logger := logc.Logger(gceLogName)

		if err := logc.Ping(ctx); err != nil {
			log.Fatalf("Failed to ping Google Cloud Logging: %v", err)
		}

		gceLogger = newGCELogger(logger)
	}

	http.Handle("/", root)
	appengine.Main()
}
开发者ID:golang,项目名称:gddo,代码行数:101,代码来源:main.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang appengine.Namespace函数代码示例发布时间:2022-05-28
下一篇:
Golang appengine.IsDevAppServer函数代码示例发布时间: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