Skip to content

Instantly share code, notes, and snippets.

@albrow
Last active August 29, 2015 14:07
Show Gist options
  • Save albrow/9dd2cddaf771238e85b6 to your computer and use it in GitHub Desktop.
Save albrow/9dd2cddaf771238e85b6 to your computer and use it in GitHub Desktop.
An alternative way of initializing wade.go applications. (Concept only)
package main
// ...
func main() {
// Create a new wade app.
app := wade.NewApp()
app.BasePath: "/web"
// Set up routing
app.Router.
Handle("/", wade.Redirecter{"/posts/top"}).
Handle("/posts/:mode", wade.Page{
Id: "pg-posts",
Title: "Posts",
}).
Handle("/comments/:postid", wade.Page{
Id: "pg-comments",
Title: "Comments for %v",
}).
Otherwise(wade.Page{
Id: "pg-404",
Title: "Page Not Found",
})
// Register components
app.Register.Components(menu.Components()...)
// Do any other initializations
// ...
app.Start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment