3 ms·
> Or do you mean that your implementation of fs.FS generates the content on-demand, when net/http serves it? It's closer to this. The actual content was alread
by nhanb 4y ago
> Or do you mean that your implementation of fs.FS generates the content on-demand, when net/http serves it?
It's closer to this. The actual content was already written to an sqlite db, and my read-only FS allows reading that data back out but as a filesystem.
The admittedly not that interesting (and probably bad - I'm new to Go) code is here[1], and this "BlogFS" is used in 2 places:
- During "export" where it generates the static site. "Folder A" is my FS and "Folder B" is the destination i.e. an actual folder on the real filesystem.
- In a preview server that just serves "Folder A" directly.
[1]: https://git.sr.ht/~nhanb/bloghead/tree/40b70cadb01c14f1e3bf5191421828061d432204/item/blogfs/blogfs.go https://git.sr.ht/~nhanb/bloghead/tree/40b70cadb01c14f1e3bf5...