diff options
| author | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-11-11 13:19:27 +0530 |
|---|---|---|
| committer | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-11-11 13:19:27 +0530 |
| commit | f4b55705c398901d25565af203c1bb5e1e0e6e69 (patch) | |
| tree | fde1255d28b161723d651dcacb3b777db898fd20 | |
| parent | ad2f596828f6f66e5c06be64497fab56b085dff5 (diff) | |
add: getting files with sandbox for just ./files work too
| -rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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") } |
