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() {

	// 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)
}