Skip to content

Commit

Permalink
Go Sandbox create cli and api entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
rxqd committed Mar 30, 2024
1 parent 563b6f5 commit 5422395
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,5 @@ yarn-debug.log*
!/storage/.keep
/public/uploads

tmp/

46 changes: 46 additions & 0 deletions src/go/sandbox/.air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
root = "./cmd/api"
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/api"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
1 change: 1 addition & 0 deletions src/go/sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/
2 changes: 1 addition & 1 deletion src/go/sandbox/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ func main() {

func hello(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"projects1": sandbox.ProjectsList(),
"projects": sandbox.ProjectsList(),
})
}
13 changes: 8 additions & 5 deletions src/go/sandbox/justfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
build_api:
go build -o bin/api cmd/api/main.go
go build -o bin/api_dev cmd/api/main.go

build_cli:
go build -o bin/cli cmd/cli/main.go
go build -o bin/cli_dev cmd/cli/main.go

run_server:
gin run -p 4200 -a 3000 sandbox/cmd/api
air

install_gin:
go install github.com/codegangsta/gin@latest
run_cli:
go run sandbox/cmd/cli

install_deps:
go install github.com/cosmtrek/air@v1.49.0

0 comments on commit 5422395

Please sign in to comment.