From 282c26ce8411e17d75c3ca47fbd3876a9e1c9cb9 Mon Sep 17 00:00:00 2001 From: veradec Date: Thu, 12 Nov 2026 09:52:07 +0530 Subject: add: html for the website --- main.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'main.go') 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") -- cgit v1.2.3