diff --git a/.air.toml b/.air.toml deleted file mode 100644 index 6b2c951..0000000 --- a/.air.toml +++ /dev/null @@ -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 diff --git a/.gitignore b/.gitignore index 0efc5d4..2eea525 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -.env -tmp \ No newline at end of file +.env \ No newline at end of file diff --git a/internal/api/api.go b/internal/api/api.go index 6aecb5b..874dbec 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -7,5 +7,6 @@ import ( func Register(cfg *types.StereoConfig) { api := cfg.Router.Group("/api") - routes.RegisterUploadRoutes(cfg, api) + + routes.RegisterPingRoutes(api) } diff --git a/internal/api/routes/ping.go b/internal/api/routes/ping.go new file mode 100644 index 0000000..b3289c1 --- /dev/null +++ b/internal/api/routes/ping.go @@ -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!") + }) +} diff --git a/internal/api/routes/upload.go b/internal/api/routes/upload.go deleted file mode 100644 index 0c8c5be..0000000 --- a/internal/api/routes/upload.go +++ /dev/null @@ -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 - } - }) -}