arnaucube
arnaucube/blogoPublic Self-hosted repository
http server using relativePath
arnaucube root@arnaucube.com
Fri, 13 May 2022 20:18:28 +0200
commit

0eda07e9a2d3c615a6cbd11cb050d804aeefdb22

parent

add29da9e4b0cea3210b1a03351a609b45ae64c7

4 files changed, 5 insertions(+), 4 deletions(-)

jump to
M main.go → main.go

@@ -12,7 +12,7 @@ "github.com/gomarkdown/markdown"

"github.com/gomarkdown/markdown/parser" ) -const version = "v0_20220503" +const version = "v0_20220513" const directory = "blogo-input" const defaultOutputDir = "public"

@@ -37,9 +37,10 @@ // go watch("./public")

// serve files fs := http.FileServer(http.Dir(config.OutputDir)) - fmt.Printf("Blog being served in: \n http://127.0.0.1:%s\n http://localhost:%s\n", - *port, *port) - log.Fatal(http.ListenAndServe(":"+*port, fs)) + http.Handle(config.RelativePath+"/", http.StripPrefix(config.RelativePath, fs)) + fmt.Printf("Blog being served in: \n http://127.0.0.1:%s%s\n http://localhost:%s%s\n", + *port, config.RelativePath, *port, config.RelativePath) + log.Fatal(http.ListenAndServe(":"+*port, nil)) } func generateHTML() {