Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (21 sloc) 0.646 kB
package main
import (
"mango"
)
// Our default handler
func Hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) {
return 200, mango.Headers{}, mango.Body("Hello World!")
}
// Our handler for /goodbye
func Goodbye(env mango.Env) (mango.Status, mango.Headers, mango.Body) {
return 200, mango.Headers{}, mango.Body("Goodbye World!")
}
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)
}
Jump to Line
Something went wrong with that request. Please try again.