aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorveradec <glitchmill.dyj3d@simplelogin.co>2026-11-11 13:19:27 +0530
committerveradec <glitchmill.dyj3d@simplelogin.co>2026-11-11 13:19:27 +0530
commitf4b55705c398901d25565af203c1bb5e1e0e6e69 (patch)
treefde1255d28b161723d651dcacb3b777db898fd20 /main.go
parentad2f596828f6f66e5c06be64497fab56b085dff5 (diff)
add: getting files with sandbox for just ./files work too
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
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")
}