Exemplo n.º 1
0
func main() {
	routes := make(map[string]mango.App)
	routes["/"] = new(mango.Stack).Compile(Index)
	routes["/get_token"] = new(mango.Stack).Compile(GetToken)

	stack := new(mango.Stack)
	stack.Middleware(mango.ShowErrors("<html><body>{Error|html}</body></html>"), mango.Routing(routes))
	stack.Address = ":3001"
	stack.Run(Index)
}
Exemplo n.º 2
0
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"

	// Route all requests for /goodbye to the Goodbye handler
	routes := map[string]mango.App{"/goodbye(.*)": Goodbye}
	stack.Middleware(mango.Routing(routes))

	// Hello handles all requests not sent to Goodbye
	stack.Run(Hello)
}