Compare commits

..

No commits in common. "db49da5fd969e731bcd4d2c95ec5f9e8782b0f8b" and "eb8d1a271c78b44d9ca912f6d3596723cf2e753e" have entirely different histories.

5 changed files with 16 additions and 79 deletions

View file

@ -1,52 +0,0 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = []
bin = "tmp\\main.exe"
cmd = "go build -o ./tmp/main.exe ."
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
silent = false
time = false
[misc]
clean_on_exit = false
[proxy]
app_port = 0
enabled = false
proxy_port = 0
[screen]
clear_on_rebuild = false
keep_scroll = true

1
.gitignore vendored
View file

@ -1,2 +1 @@
.env .env
tmp

View file

@ -7,5 +7,6 @@ import (
func Register(cfg *types.StereoConfig) { func Register(cfg *types.StereoConfig) {
api := cfg.Router.Group("/api") api := cfg.Router.Group("/api")
routes.RegisterUploadRoutes(cfg, api)
routes.RegisterPingRoutes(api)
} }

View file

@ -0,0 +1,13 @@
package routes
import (
"net/http"
"github.com/gin-gonic/gin"
)
func RegisterPingRoutes(api *gin.RouterGroup) {
api.GET("/ping", func(c *gin.Context) {
c.String(http.StatusOK, "Pong!")
})
}

View file

@ -1,24 +0,0 @@
package routes
import (
"path/filepath"
"github.com/gin-gonic/gin"
"stereo.cat/backend/internal/types"
)
func RegisterUploadRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) {
api.POST("/upload", func(c *gin.Context) {
file, err := c.FormFile("file")
if err != nil {
c.JSON(400, gin.H{"error": "file is required"})
return
}
filePath := filepath.Join(cfg.ImagePath, file.Filename)
if err := c.SaveUploadedFile(file, filePath); err != nil {
c.JSON(500, gin.H{"error": "failed to save file"})
return
}
})
}