func main() { hostId, port := handleCommandLine() node.Init() config.Init(fmt.Sprintf("%d_%d", hostId, port)) node.CheckSelf() logger.Init() state.Init() handler.Init(port) }
func main() { if os.Getenv("RUN_DAEMON") != "1" { daemon.Fork() } config.Init() for { fmt.Println("test") time.Sleep(time.Second * 10) break } }
func main() { currentDir, err := os.Getwd() if err != nil { log.Fatal(err) } configJson := fmt.Sprintf("%s/config.json", currentDir) config.Init(configJson, "dev") http.Handle("/user/login", handlers.JsonHandler(user.LoginUser)) http.Handle("/restaurant/add", handlers.JsonHandler(restaurant.AddNewRestaurant)) http.Handle("/restaurant/branch/add", handlers.JsonHandler(restaurant.AddNewBranch)) http.Handle("/restaurant/branch/edit", handlers.JsonHandler(restaurant.EditBranch)) http.Handle("/restaurant", handlers.JsonHandler(restaurant.Restaurant)) http.Handle("/restaurant/item/add", handlers.JsonHandler(item.AddItem)) http.Handle("/restaurant/item/sku/add", handlers.JsonHandler(item.AddSku)) http.Handle("/restaurant/menu/add", handlers.JsonHandler(menu.AddMenu)) http.Handle("/restaurant/menu/category/add", handlers.JsonHandler(menu.AddMenuCategory)) http.Handle("/restaurant/menu/category/item/add", handlers.JsonHandler(menu.AddMenuCatItem)) log.Print(http.ListenAndServe(":8080", nil)) }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) //cc := config.Host{} config.Init() wb.Init() inspect.Inspect() defer func() { if r := recover(); r != nil { model.CheckRecover() } }() //go model.Copy() http.HandleFunc("/chat/", Index) http.HandleFunc("/inspect/", Home) //Println("step") //http.HandleFunc("/chat/", Home) //go model.Run() //go h.run() //wb.StartListenBroad() if err := http.ListenAndServe(":8010", nil); err != nil { log.Fatal("Listen and add serve error ", err) } }