当前位置: 首页>>代码示例>>Golang>>正文


Golang Stack.Middleware方法代码示例

本文整理汇总了Golang中mango.Stack.Middleware方法的典型用法代码示例。如果您正苦于以下问题:Golang Stack.Middleware方法的具体用法?Golang Stack.Middleware怎么用?Golang Stack.Middleware使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mango.Stack的用法示例。


在下文中一共展示了Stack.Middleware方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: main

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)
}
开发者ID:qrush,项目名称:higo,代码行数:7,代码来源:logger.go

示例2: main

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

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

	stack.Run(Hello)
}
开发者ID:victorcoder,项目名称:mango,代码行数:8,代码来源:silence.go

示例3: main

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)
}
开发者ID:flavioribeiro,项目名称:stewie-go,代码行数:10,代码来源:app.go

示例4: main

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)
}
开发者ID:victorcoder,项目名称:mango,代码行数:11,代码来源:routing.go

示例5: main

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)
}
开发者ID:victorcoder,项目名称:mango,代码行数:13,代码来源:cats.go

示例6: main

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)
}
开发者ID:aleksclark,项目名称:vigia,代码行数:22,代码来源:vigia.go

示例7: main

func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"
	stack.Middleware(mango.Sessions("my_secret", "my_session_key", ".my.domain.com"))
	stack.Run(Hello)
}
开发者ID:victorcoder,项目名称:mango,代码行数:6,代码来源:session.go


注:本文中的mango.Stack.Middleware方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。