mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
20 lines
367 B
Go
20 lines
367 B
Go
package nebula
|
|
|
|
import (
|
|
"embed"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
//go:embed assets
|
|
var embeddedFiles embed.FS
|
|
|
|
// UseAssets is a middleware that serves static files from the embedded assets
|
|
func UseAssets(e *echo.Echo) echo.HandlerFunc {
|
|
embFs := http.FS(os.DirFS("assets"))
|
|
assets := http.FileServer(embFs)
|
|
return echo.WrapHandler(assets)
|
|
}
|