mirror of
https://github.com/arnaucube/gogame.git
synced 2026-02-07 19:46:39 +01:00
add UpgradeBuilding functionallity
This commit is contained in:
@@ -3,6 +3,7 @@ package endpoint
|
||||
import (
|
||||
"github.com/arnaucube/gogame/config"
|
||||
"github.com/arnaucube/gogame/database"
|
||||
"github.com/arnaucube/gogame/services/gamesrv"
|
||||
"github.com/arnaucube/gogame/services/usersrv"
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
var serverConfig config.Config
|
||||
var db *database.Db
|
||||
var userservice *usersrv.Service
|
||||
var gameservice *gamesrv.Service
|
||||
|
||||
func newApiService() *gin.Engine {
|
||||
api := gin.Default()
|
||||
@@ -22,12 +24,15 @@ func newApiService() *gin.Engine {
|
||||
|
||||
// TODO add jwt checker
|
||||
api.GET("/resources/:userid", handleGetResources)
|
||||
api.GET("/planets/:userid", handleGetUserPlanets)
|
||||
api.POST("/buildings/:userid", handlePostUpgradeBuilding)
|
||||
return api
|
||||
}
|
||||
|
||||
func Serve(cnfg config.Config, _db *database.Db, _userservice *usersrv.Service) *gin.Engine {
|
||||
func Serve(cnfg config.Config, _db *database.Db, _userservice *usersrv.Service, _gameservice *gamesrv.Service) *gin.Engine {
|
||||
serverConfig = cnfg
|
||||
db = _db
|
||||
userservice = _userservice
|
||||
gameservice = _gameservice
|
||||
return newApiService()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user