Skip to content

Instantly share code, notes, and snippets.

@naaman
Created March 6, 2014 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naaman/9382213 to your computer and use it in GitHub Desktop.
Save naaman/9382213 to your computer and use it in GitHub Desktop.
package main
import (
"foo/v3"
v1 "baz/v1"
"baz/v2"
)
func main() {
bourbon.Run(foo.Server, v1.Server, baz.Server)
}
func main() {
public := // server of something
private := // server of something
private.Use(my.Middleware)
private.Use(oauth.Middleware)
private.Use(auth.Basic("user", "pass"))
public.Get("/", func() (int, map[string]string, *AppInfo) {
status := 200
headers := map[string]string{ "Request-Id": 10 }
appInfo := new(AppInfo)
return status, headers, appInfo
})
private.Get("/", func(response *bourbon.Response){
response.Headerprivate.Add("Key", "Value")
response.Cookieprivate.Add("Key", "Value")
})
private.Get("/", func(s *bourbon.Stream){
for {
private.Write("something")
private.Encode(appInfo)
}
})
bourbon.Run(private, public)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment