Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: use echo static middleware to serve dist
boojack1b50ab5dca49
diff --git a/.gitignore b/.gitignoreindex 0f5553016..3ddbd6939 100644--- a/.gitignore+++ b/.gitignore@@ -1,29 +1,10 @@-# Binaries for programs and plugins-*.exe-*.exe~-*.dll-*.so-*.dylib--# Test binary, built with `go test -c`-*.test--# Temp output-*.out-*.log-tmp-# Air (hot reload) generated.air# Frontend assetweb/dist-# Dev database-data-# build folder-buildmemos-build.DS_Store\ No newline at end of filediff --git a/server/embed_frontend.go b/server/embed_frontend.goindex 3efc4e955..e232ed1ab 100644--- a/server/embed_frontend.go+++ b/server/embed_frontend.go@@ -6,14 +6,12 @@ import ("net/http""github.com/labstack/echo/v4"+ "github.com/labstack/echo/v4/middleware")//go:embed distvar embeddedFiles embed.FS-//go:embed dist/index.html-var indexContent string-func getFileSystem() http.FileSystem {fs, err := fs.Sub(embeddedFiles, "dist")if err != nil {@@ -24,14 +22,8 @@ func getFileSystem() http.FileSystem {}func embedFrontend(e *echo.Echo) {- // Catch-all route to return index.html, this is to prevent 404 when accessing non-root url.- // See https://stackoverflow.com/questions/27928372/react-router-urls-dont-work-when-refreshing-or-writing-manually- e.GET("/*", func(c echo.Context) error {- return c.HTML(http.StatusOK, indexContent)- })-- assetHandler := http.FileServer(getFileSystem())- e.GET("/assets/*", echo.WrapHandler(assetHandler))- e.GET("/icons/*", echo.WrapHandler(assetHandler))- e.GET("/favicon.svg", echo.WrapHandler(assetHandler))+ e.Use(middleware.StaticWithConfig(middleware.StaticConfig{+ HTML5: true,+ Filesystem: getFileSystem(),+ }))}