Last active
August 29, 2015 14:07
-
-
Save albrow/9dd2cddaf771238e85b6 to your computer and use it in GitHub Desktop.
An alternative way of initializing wade.go applications. (Concept only)
This file contains 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 | |
// ... | |
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