package cmd import ( "fmt" "github.com/urfave/cli/v2" "go.jolheiser.com/beaver" "go.jolheiser.com/gpm/modules/router" "net/http" ) var Server = cli.Command{ Name: "server", Usage: "Start the gpm server", Flags: []cli.Flag{ &cli.StringFlag{ Name: "port", Aliases: []string{"p"}, Usage: "Port to run the gpm server on", Value: "3333", }, }, Action: doServer, } func doServer(ctx *cli.Context) error { beaver.Infof("Running gpm server at http://localhost:%s", ctx.String("port")) if err := http.ListenAndServe(fmt.Sprintf(":%s", ctx.String("port")), router.Init()); err != nil { return err } return nil }