From f4b55705c398901d25565af203c1bb5e1e0e6e69 Mon Sep 17 00:00:00 2001 From: veradec Date: Wed, 11 Nov 2026 13:19:27 +0530 Subject: add: getting files with sandbox for just ./files work too --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 4e528df..c0ba6a5 100644 --- a/main.go +++ b/main.go @@ -27,5 +27,15 @@ func main(){ c.SaveUploadedFile(file, dst) c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!\n", file.Filename)) }) + + router.GET("/", func(c *gin.Context) { + c.String(http.StatusOK, fmt.Sprintf("HTTP WORKS TOO!")) + }) + + var safeFS http.FileSystem = http.Dir("./files") + router.GET("/:name", func(c *gin.Context) { + c.FileFromFS(c.Param("name"), safeFS) + }) + router.Run(":8080") } -- cgit v1.2.3