4 ms·
embed.FS is really cool. If you wanna see what it looks like, check out how I build ntfy [0]. It ships with the docs (built from mkdocs, see [1]) and the React
by binwiederhier 4y ago
embed.FS is really cool. If you wanna see what it looks like, check out how I build ntfy [0]. It ships with the docs (built from mkdocs, see [1]) and the React web app [2] all in a single binary.
Here are the embed statements [3]. One thing to note is that embed.FS does not send 304 Not Modified status back, which is why I made a CachingEmbedFS [4].
[0] https://github.com/binwiederhier/ntfy/blob/main/Makefile#L77 https://github.com/binwiederhier/ntfy/blob/main/Makefile#L77
[1] https://ntfy.sh/docs/ https://ntfy.sh/docs/
[2] https://ntfy.sh/app https://ntfy.sh/app
[3] https://github.com/binwiederhier/ntfy/blob/main/server/server.go#L79-L88 https://github.com/binwiederhier/ntfy/blob/main/server/serve...
[4] https://github.com/binwiederhier/ntfy/blob/main/util/embedfs.go https://github.com/binwiederhier/ntfy/blob/main/util/embedfs...