Browse Source

http server using relativePath

master
arnaucube 2 years ago
parent
commit
0eda07e9a2
4 changed files with 5 additions and 4 deletions
  1. BIN
      bin/blogo-amd64-darwin
  2. BIN
      bin/blogo-amd64-linux
  3. BIN
      bin/blogo-amd64.exe
  4. +5
    -4
      main.go

BIN
bin/blogo-amd64-darwin


BIN
bin/blogo-amd64-linux


BIN
bin/blogo-amd64.exe


+ 5
- 4
main.go

@ -12,7 +12,7 @@ import (
"github.com/gomarkdown/markdown/parser" "github.com/gomarkdown/markdown/parser"
) )
const version = "v0_20220503"
const version = "v0_20220513"
const directory = "blogo-input" const directory = "blogo-input"
const defaultOutputDir = "public" const defaultOutputDir = "public"
@ -37,9 +37,10 @@ func main() {
// serve files // serve files
fs := http.FileServer(http.Dir(config.OutputDir)) 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() { func generateHTML() {

Loading…
Cancel
Save