diff options
| author | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-11-12 09:52:07 +0530 |
|---|---|---|
| committer | veradec <glitchmill.dyj3d@simplelogin.co> | 2026-11-12 09:52:07 +0530 |
| commit | 282c26ce8411e17d75c3ca47fbd3876a9e1c9cb9 (patch) | |
| tree | a097ad718a78c53bc83473cb3164a74c4f7ca602 /main.go | |
| parent | f4b55705c398901d25565af203c1bb5e1e0e6e69 (diff) | |
add: html for the website
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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") |
