mirror of
https://github.com/arnaucube/gogame.git
synced 2026-02-07 03:26:39 +01:00
minimal register&login working
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/arnaucube/gogame/config"
|
||||
"github.com/arnaucube/gogame/database"
|
||||
"github.com/arnaucube/gogame/endpoint"
|
||||
"github.com/arnaucube/gogame/services/usersrv"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -9,16 +13,28 @@ var ServerCommands = []cli.Command{
|
||||
Name: "start",
|
||||
Aliases: []string{},
|
||||
Usage: "start the server",
|
||||
Action: cmdStart,
|
||||
Action: start,
|
||||
},
|
||||
}
|
||||
|
||||
func cmdStart(c *cli.Context) error {
|
||||
func start(c *cli.Context) error {
|
||||
if err := config.MustRead(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
endpoint.Serve()
|
||||
db, err := database.New(config.C.Mongodb.Url, config.C.Mongodb.Database)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// services
|
||||
userservice := usersrv.New(db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
apiService := endpoint.Serve(config.C, db, userservice)
|
||||
apiService.Run(config.C.Server.ServiceApi)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user