diff --git a/README.md b/README.md index 1a38c9d..96ef391 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,4 @@ gore - [ ] actually rewrite this properly - [ ] serve `index.html` from `/` - [ ] pack the assetins into the [binary](https://github.com/gin-gonic/examples/tree/master/assets-in-binary) +- [ ] mise tasks for testing, releasing, etc, [example](https://github.com/jdx/mise/blob/main/tasks.toml) diff --git a/api/.air.toml b/backend/.air.toml similarity index 100% rename from api/.air.toml rename to backend/.air.toml diff --git a/backend/conf/app.toml b/backend/conf/app.toml new file mode 100644 index 0000000..e69de29 diff --git a/api/go.mod b/backend/go.mod similarity index 97% rename from api/go.mod rename to backend/go.mod index 65e00e5..bdd3b07 100644 --- a/api/go.mod +++ b/backend/go.mod @@ -1,4 +1,4 @@ -module api +module git.madunde.ad/madundead/obi go 1.25.3 diff --git a/api/go.sum b/backend/go.sum similarity index 100% rename from api/go.sum rename to backend/go.sum diff --git a/api/main.go b/backend/main.go similarity index 87% rename from api/main.go rename to backend/main.go index bbf20d3..68963b8 100644 --- a/api/main.go +++ b/backend/main.go @@ -1,7 +1,6 @@ package main import ( - // "fmt" "io/fs" "log" "os" @@ -12,12 +11,15 @@ import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" + + "git.madunde.ad/madundead/obi/routers" ) func main() { router := gin.Default() router.SetTrustedProxies([]string{"127.0.0.1"}) // TODO: fix All origins allowed by default router.Use(cors.Default()) + list := listFiles("/home/madundead/Syncthing/Obsidian/Personal") router.GET("/api/v1/files", func(c *gin.Context) { @@ -29,17 +31,11 @@ func main() { router.GET("/api/v1/files/:id", func(c *gin.Context) { id := c.Params.ByName("id") - // value, ok := db[user] - // if ok { path, _ := base64.StdEncoding.DecodeString(id) data, _ := os.ReadFile(string(path)) - // fmt.Print(string(dat)) c.JSON(http.StatusOK, gin.H{"data": string(data)}) - // } else { - // c.JSON(http.StatusOK, gin.H{"user": user, "status": "no value"}) - // } }) if err := router.Run(); err != nil { diff --git a/backend/routers/go.mod b/backend/routers/go.mod new file mode 100644 index 0000000..11b2d26 --- /dev/null +++ b/backend/routers/go.mod @@ -0,0 +1,3 @@ +module routers + +go 1.25.3 diff --git a/backend/routers/main.go b/backend/routers/main.go new file mode 100644 index 0000000..7bcfa6f --- /dev/null +++ b/backend/routers/main.go @@ -0,0 +1,4 @@ +package routers + +func init() { +} diff --git a/backend/tmp/build-errors.log b/backend/tmp/build-errors.log new file mode 100644 index 0000000..680644c --- /dev/null +++ b/backend/tmp/build-errors.log @@ -0,0 +1 @@ +exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1 \ No newline at end of file diff --git a/backend/tmp/main b/backend/tmp/main new file mode 100755 index 0000000..b6ded76 Binary files /dev/null and b/backend/tmp/main differ diff --git a/mise.toml b/mise.toml index 06ef001..9dc3ab5 100644 --- a/mise.toml +++ b/mise.toml @@ -3,13 +3,8 @@ go = "latest" bun = "latest" [env] -# PORT = "8912" # api port -# FRONTEND_PORT = "8913" +BE_PORT = "8912" # api port +FE_PORT = "8913" -[tasks.dev] -description = 'Run BE & FE in tmux' -run = [ - 'tmux new-window "cd api; go install; PORT=8912 air"', - 'tmux split-window "cd frontend; bun install; PORT=8913 bun src/index.tsx"', - 'xdg-open "http://localhost:8913" || open "http://localhost:8913"' -] +[task_config] +includes = ["tasks.toml"] diff --git a/tasks.toml b/tasks.toml new file mode 100644 index 0000000..82ee1a3 --- /dev/null +++ b/tasks.toml @@ -0,0 +1,10 @@ +[dev] +run = 'mise dev:tmux' + +["dev:tmux"] +description = 'Run BE & FE in tmux' +run = [ + 'tmux new-window "cd backend; go install; PORT=8912 air"', + 'tmux split-window "cd frontend; bun install; PORT=8913 bun src/index.tsx"', + 'sleep 0.1 && (xdg-open "http://localhost:8913" || open "http://localhost:8913")' +]