コード例 #1
0
ファイル: mangoInitiator.go プロジェクト: paulbellamy/skynet
func main() {
	// Pull in command line options or defaults if none given
	flag.Parse()

	f, err := os.OpenFile(*skylib.LogFileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
	if err == nil {
		defer f.Close()
		log.SetOutput(f)
	}

	skylib.Setup(sName)

	homeTmpl = template.MustParse(homeTemplate, nil)
	respTmpl = template.MustParse(responseTemplate, nil)

	rpc.HandleHTTP()

	portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port)

	stack := new(mango.Stack)
	stack.Address = portString

	routes := make(map[string]mango.App)
	routes["/"] = homeHandler
	routes["/new"] = submitHandler
	stack.Middleware(mango.Routing(routes))
	stack.Run(nil)
}
コード例 #2
0
ファイル: app.go プロジェクト: kashdan/esther_go
func main() {
	stack := new(mango.Stack)
	stack.Address = ":" + os.Getenv("PORT")

	// 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)
}
コード例 #3
0
ファイル: server.go プロジェクト: bryanjos/goken
func StartServer() {
	routes := make(map[string]mango.App)
	routes["/hello"] = new(mango.Stack).Compile(hello)
	routes["/bye"] = new(mango.Stack).Compile(bye)

	testServer := new(mango.Stack)
	testServer.Middleware(mango.ShowErrors("<html><body>{Error|html}</body></html>"), mango.Routing(routes))
	testServer.Address = "localhost:" + Configuration.Server_Port
	testServer.Run(routeNotFound)
	fmt.Printf("Running server on: %s\n", testServer.Address)
}
コード例 #4
0
func main() {
	// Pull in command line options or defaults if none given
	flag.Parse()

	skylib.NewAgent().Start()

	homeTmpl = template.MustParse(homeTemplate, nil)
	respTmpl = template.MustParse(responseTemplate, nil)

	portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port)

	stack := new(mango.Stack)
	stack.Address = portString

	routes := make(map[string]mango.App)
	routes["/"] = homeHandler
	routes["/new"] = submitHandler
	stack.Middleware(mango.Routing(routes))
	stack.Run(nil)
}
コード例 #5
0
ファイル: main.go プロジェクト: uglyog/example_pact_with_go
func main() {
	stack := new(mango.Stack)
	stack.Address = ":3000"
	stack.Middleware(mango.ShowErrors(""))
	stack.Run(pact.Producer)
}