liuyuqi-cnb 2 months ago
parent
commit
267f1373e8
3 changed files with 16 additions and 7 deletions
  1. 3 7
      back-go/cmd/filecloud.go
  2. BIN
      back-go/data/filecloud.db
  3. 13 0
      back-go/public/index.html

+ 3 - 7
back-go/cmd/filecloud.go

@@ -1,16 +1,15 @@
 package main
 
 import (
-	"embed"
 	"flag"
 	"log"
-	"net/http"
 
 	"github.com/gin-gonic/gin"
 	swaggerFiles "github.com/swaggo/files"
 	ginSwagger "github.com/swaggo/gin-swagger"
 	"filecloud/internal/database"
 	"filecloud/internal/handler"
+	"filecloud/service"
 	// _ "filecloud/docs"
 )
 
@@ -18,9 +17,6 @@ var (
 	configPath = flag.String("file", "./config.toml", "config file")
 )
 
-//go:embed public/*
-var publicFS embed.FS
-
 // @title FileCloud API
 // @version 1.0
 // @description FileCloud API documentation
@@ -39,8 +35,8 @@ func main() {
 
 	r := gin.Default()
 
-	// Serve static files from embedded frontend
-	r.StaticFS("/", http.FS(publicFS))
+	// 用本地静态文件服务替代 embed,改为 /static 路径
+	r.Static("/static", "./public")
 
 	// API routes
 	api := r.Group("/api")

BIN
back-go/data/filecloud.db


+ 13 - 0
back-go/public/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>FileCloud</title>
+</head>
+
+<body>
+    <h1>Welcome to FileCloud</h1>
+    <p>API documentation is available at <a href="/swagger/index.html">/swagger/index.html</a></p>
+</body>
+
+</html>