init
All checks were successful
Build and Push / build-and-push (push) Successful in 1m5s

This commit is contained in:
Konstantin Grachev
2025-07-18 22:20:49 +03:00
commit 4e06ababf3
5 changed files with 84 additions and 0 deletions

27
main.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import (
"embed"
"io/fs"
"log"
"net/http"
)
//go:embed public/*
var publicFS embed.FS
func main() {
// Получаем подпапку 'public' из embed.FS
pub, err := fs.Sub(publicFS, "public")
if err != nil {
log.Fatal(err)
}
// Создаем файловый сервер с корнем в подпапке public
fileServer := http.FileServer(http.FS(pub))
http.Handle("/", fileServer)
log.Println("Server starting on :8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}