func main() { services.InitDb() defer LogErr() defer services.DB.Close() //routes router := httprouter.New() router.HandleMethodNotAllowed = false router.NotFound = http.HandlerFunc(NotFoundHandler) router.GET("/balance", controllers.GetBalance) router.POST("/deposite", controllers.AddAmount) router.POST("/withdraw", controllers.WithdrawAmount) router.POST("/transfer", controllers.TransferAmount) //start http Log.Printf("started at port: %s", Port) Log.Fatal(endless.ListenAndServe(":"+Port, router)) }
func main() { services.InitDb() defer LogErr() defer services.DB.Close() //routes router := httprouter.New() router.HandleMethodNotAllowed = false router.NotFound = http.HandlerFunc(NotFoundHandler) router.POST("/api/v1/model.find_by_name", controllers.GetModelByName) //close old app and write new pid ReplacePid() endless.DefaultHammerTime = -1 //start http Log.Printf("started at port: %s", Port) Log.Fatal(endless.ListenAndServe(":"+Port, router)) }
func init() { services.InitDb() services.DB.AutoMigrate(&models.UserBalance{}) }
func init() { services.InitDb() services.DB.AutoMigrate(&models.Model{}) }