Created
March 6, 2014 04:07
-
-
Save naaman/9382213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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