// The Router application registers RPC listeners to accept from the initiators // then registers RPC clients to each of the external services it may call. func main() { var err os.Error // 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("Watcher.Generic") // Change this to be more descriptive rpc.HandleHTTP() go monitorServices() portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port) l, e := net.Listen("tcp", portString) if e != nil { log.Fatal("listen error:", e) } log.Println("Starting server") http.Serve(l, nil) }
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) r := NewGetUserDataService() rpc.Register(r) rpc.HandleHTTP() portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port) l, e := net.Listen("tcp", portString) if e != nil { log.Fatal("listen error:", e) } log.Println("Starting server") http.Serve(l, nil) }
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) }
func main() { // TODO: handle panic so that we still remove ourselces from the pool // 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) } s := skylib.Setup("Chicago", sName, false, "abc") defer s.RemoveFromConfig() r := NewGetUserDataService() rpc.Register(r) rpc.HandleHTTP() portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port) l, e := net.Listen("tcp", portString) if e != nil { log.Fatal("listen error:", e) } log.Println("Starting server") http.Serve(l, nil) }
func main() { var err os.Error // 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) http.HandleFunc("/", homeHandler) http.HandleFunc("/new", submitHandler) rpc.HandleHTTP() portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port) err = http.ListenAndServe(portString, nil) if err != nil { log.Fatal("ListenAndServe: ", err.String()) } }
// The Router application registers RPC listeners to accept from the initiators // then registers RPC clients to each of the external services it may call. func main() { var err os.Error // 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) CreateInitialRoute() route, err = skylib.GetRoute(sName) if err != nil { log.Panic("Unable to retrieve route.") } r := &RouteService{Name: *skylib.Name} rpc.Register(r) rpc.HandleHTTP() portString := fmt.Sprintf("%s:%d", *skylib.BindIP, *skylib.Port) l, e := net.Listen("tcp", portString) if e != nil { log.Fatal("listen error:", e) } log.Println("Starting server") http.Serve(l, nil) }