Add static file server #23 v1 APPLIED

Joe Roe: 1
 Add static file server #23

 3 files changed, 7 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~amolith/public-inbox/patches/48617/mbox | git am -3
Learn more about email & git

[PATCH] Add static file server #23 Export this patch

From: Joe Roe <joe@joeroe.io>

 README.md    | 6 ++++--
 main.go      | 3 +++
 static/.keep | 0
 3 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 static/.keep

diff --git a/README.md b/README.md
index 30424a9..36e1497 100644
--- a/README.md
+++ b/README.md
@@ -80,13 +80,15 @@ $ ./go-webring

To run your own webring, you'll first need a template homepage. This should be
any HTML file with the string "`{{ . }}`" placed wherever you want the table of
members inserted. This table is plain HTML so you can style it with CSS in the
template's `<head>` or in a separate `.css` file.
members inserted. This table is plain HTML so you can style it with CSS.

Pandoc produces very pleasing (in my opinion) standalone HTML pages; if you just
want something simple, I would recommend modifying the included `index.md` and
generating your homepage as in section above.

To serve other files (such as styles a separate `.css` file), place them in the
`static/` directory.

Next, you'll need a text file containing a list of members. On each line should
be the member's unique identifer (such as their username) followed by a single
space followed by their site's URI omitting the scheme. For example, if a user
diff --git a/main.go b/main.go
index 8f3bd31..41bfa97 100644
--- a/main.go
+++ b/main.go
@@ -78,6 +78,9 @@ func main() {
	mux.HandleFunc("/random", m.random)
	mux.HandleFunc("/"+*flagValidationLog, m.validationLog)

	fileHandler := http.StripPrefix("/static/", http.FileServer(http.Dir("static")))
	mux.Handle("/static/", fileHandler)

	if err := httpServer.ListenAndServe(); err == http.ErrServerClosed {
		log.Println("Web server closed")
	} else {
diff --git a/static/.keep b/static/.keep
new file mode 100644
index 0000000..e69de29
Applied and pushed, thanks! :)