mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-06-24 10:46:16 +00:00
Add run commands
This commit is contained in:
parent
ac0a8df205
commit
4318b3ed47
5 changed files with 80 additions and 19 deletions
27
cmd/run.go
Normal file
27
cmd/run.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/Fluffy-Bean/TastyBites/api"
|
||||
)
|
||||
|
||||
func run(flags []string) {
|
||||
cmd := flag.NewFlagSet("run", flag.ExitOnError)
|
||||
|
||||
host := cmd.String("host", "127.0.0.1:8080", "Host address, such as 0.0.0.0:8080")
|
||||
logging := cmd.Bool("log", false, "Enable logging for the application")
|
||||
|
||||
err := cmd.Parse(flags)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
api.Serve(api.Config{
|
||||
Host: *host,
|
||||
Logging: *logging,
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue