Skip to content

Instantly share code, notes, and snippets.

@naaman

naaman/foobarbaz.go

Created Mar 6, 2014
Embed
What would you like to do?
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