Beispiel #1
0
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"
	custom_logger := log.New(os.Stdout, "", log.Ldate|log.Ltime)
	stack.Middleware(mango.Logger(custom_logger))
	stack.Run(Hello)
}
Beispiel #2
0
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"

	stack.Middleware(silence.SilenceErrors) // Include our custom middleware

	stack.Run(Hello)
}
Beispiel #3
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)
}
Beispiel #4
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)
}
Beispiel #5
0
func main() {

	stack := new(mango.Stack)
	stack.Address = ":3000"

	// Initialize our cats middleware with our list of cat_images
	cat_images := []string{"http://images.cheezburger.com/completestore/2010/7/4/9440dc57-52a6-4122-9ab3-efd4daa0ff60.jpg", "http://images.icanhascheezburger.com/completestore/2008/12/10/128733944185267668.jpg"}
	cats_middleware := cats.Cats(cat_images)

	stack.Middleware(cats_middleware) // Include the Cats middleware in our stack

	stack.Run(Hello)
}
Beispiel #6
0
func main() {

	// redis hello world
	c, err := redis.Dial("tcp", ":6379")
	if err != nil {
		// handle error
	} else {
		fmt.Println("Hello, 世界")
	}
	c.Do("SET", "k1", 1)
	defer c.Close()

	ci := make(chan int, 10)
	go ProbeManager(ci)

	t1 := Probe{}
	fmt.Println("Rectangle r1 is: ", t1)
	stack := new(mango.Stack)
	stack.Address = ":3000"
	stack.Middleware(mango.ShowErrors(""))
	stack.Run(Hello)
}
Beispiel #7
0
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"
	stack.Middleware(mango.Sessions("my_secret", "my_session_key", ".my.domain.com"))
	stack.Run(Hello)
}
Beispiel #8
0
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"
	stack.Run(Hello)
}