Skip to content

Instantly share code, notes, and snippets.

@IndianGuru
Last active September 20, 2015 07:29
Show Gist options
  • Select an option

  • Save IndianGuru/0b91438129f271b99407 to your computer and use it in GitHub Desktop.

Select an option

Save IndianGuru/0b91438129f271b99407 to your computer and use it in GitHub Desktop.
Register the services
func init() {
// register the quotes API with cloud endpoints.
api, err := endpoints.RegisterService(QuotesAPI{}, "quotesService", "v1", "Quotes API", true)
if err != nil {
panic(err)
}
// adapt the name, method, and path for each method.
info := api.MethodByName("List").Info()
info.Name, info.HTTPMethod, info.Path = "getQuotes", "GET", "quotesService"
info = api.MethodByName("Add").Info()
info.Name, info.HTTPMethod, info.Path = "addQuote", "POST", "quotesService"
// start handling cloud endpoint requests.
endpoints.HandleHTTP()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment