예제 #1
0
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))
}
예제 #2
0
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))
}
예제 #3
0
func init() {
	services.InitDb()
	services.DB.AutoMigrate(&models.UserBalance{})
}
예제 #4
0
func init() {
	services.InitDb()
	services.DB.AutoMigrate(&models.Model{})
}