本文整理汇总了Golang中google/golang.org/appengine.Main函数的典型用法代码示例。如果您正苦于以下问题:Golang Main函数的具体用法?Golang Main怎么用?Golang Main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Main函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
http.HandleFunc("/call/receive", receiveCallHandler)
http.HandleFunc("/sms/send", sendSMSHandler)
http.HandleFunc("/sms/receive", receiveSMSHandler)
appengine.Main()
}
示例2: main
func main() {
// Serve static files from "static" directory.
http.Handle("/static/", http.FileServer(http.Dir(".")))
http.HandleFunc("/", homepageHandler)
appengine.Main()
}
示例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()
}
示例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()
}
示例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()
}
示例6: main
func main() {
var err error
api.Tracer, err = trace.NewClient(appengine.BackgroundContext(), "ellies-pad")
if err != nil {
panic(err)
}
appengine.Main()
}
示例7: main
func main() {
initStorage()
go restartAbandonedOperations()
setupHandlers()
appengine.Main()
}
示例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()
}
示例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()
}
示例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()
}
示例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()
}
示例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()
}
示例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()
}
示例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()
}
示例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()
}