Skip to content

Commit

Permalink
root served dist FS
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekys committed Mar 2, 2021
1 parent 66e6941 commit 27ca08f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion meshdirectory_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package meshdirectory_web

import (
"embed"
"io/fs"
"net/http"
)

//go:embed dist/*
var spaDist embed.FS

func ServeMeshDirectorySPA(w http.ResponseWriter, r *http.Request) {
var server = http.FileServer(http.FS(spaDist))
distFS, _ := fs.Sub(spaDist, "dist")
server := http.FileServer(http.FS(distFS))
server.ServeHTTP(w, r)
}

0 comments on commit 27ca08f

Please sign in to comment.