minimal register&login working

This commit is contained in:
arnaucube
2019-06-13 20:26:05 +02:00
parent f7a5bbb91e
commit 0cd29328b4
17 changed files with 348 additions and 16 deletions

View File

@@ -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
}