aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorveradec <glitchmill.dyj3d@simplelogin.co>2026-11-12 09:52:07 +0530
committerveradec <glitchmill.dyj3d@simplelogin.co>2026-11-12 09:52:07 +0530
commit282c26ce8411e17d75c3ca47fbd3876a9e1c9cb9 (patch)
treea097ad718a78c53bc83473cb3164a74c4f7ca602 /main.go
parentf4b55705c398901d25565af203c1bb5e1e0e6e69 (diff)
add: html for the website
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/main.go b/main.go
index c0ba6a5..9af9e21 100644
--- a/main.go
+++ b/main.go
@@ -3,14 +3,11 @@ package main
import (
"net/http"
"fmt"
+ "log"
"path/filepath"
"github.com/gin-gonic/gin"
)
-func index(c *gin.Context){
-
-}
-
func main(){
router := gin.Default()
@@ -21,15 +18,17 @@ func main(){
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
- fmt.Println(file.Filename)
+ log.Println(file.Filename)
dst := filepath.Join("./files/", filepath.Base(file.Filename))
c.SaveUploadedFile(file, dst)
- c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!\n", file.Filename))
+ c.String(http.StatusOK, fmt.Sprintf("%s/%s\n", domain , file.Filename))
})
+ router.LoadHTMLFiles("index.html")
+
router.GET("/", func(c *gin.Context) {
- c.String(http.StatusOK, fmt.Sprintf("HTTP WORKS TOO!"))
+ c.HTML(http.StatusOK, "index.html", gin.H{})
})
var safeFS http.FileSystem = http.Dir("./files")