-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
|
||
_ "github.com/lib/pq" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var backendCmd = &cli.Command{ | ||
Check failure on line 12 in cli/commands/backend.go GitHub Actions / Lint
|
||
Name: "backend", | ||
Check failure on line 13 in cli/commands/backend.go GitHub Actions / Lint
|
||
Usage: "Starts the backend server in development mode", | ||
Action: func(c *cli.Context) error { | ||
cmd := exec.Command("go", "run", "backend/main.go", "--use-dev-dot-env") | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
err := cmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("error starting backend: %w", err) | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
func BackendCommand() *cli.Command { | ||
command := &cli.Command{ | ||
Name: "backend", | ||
Usage: "Starts the backend server", | ||
Aliases: []string{"be"}, | ||
Flags: []cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "use-dev-dot-env", | ||
Usage: "Use the .env file in the backend directory", | ||
Aliases: []string{"d"}, | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
RunBackend() | ||
Check failure on line 40 in cli/commands/backend.go GitHub Actions / Lint
|
||
|
||
return nil | ||
}, | ||
} | ||
|
||
return command | ||
} | ||
|
||
func RunBackend() error { | ||
cmd := exec.Command("go", "run", "main.go") | ||
cmd.Dir = BACKEND_DIR | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
err := cmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("error starting backend: %w", err) | ||
} | ||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters