Skip to content

Instantly share code, notes, and snippets.

@sinnlosername
Created January 15, 2018 22:41
Show Gist options
  • Save sinnlosername/9904ea8aaf7113ef1e365309b0b465b1 to your computer and use it in GitHub Desktop.
Save sinnlosername/9904ea8aaf7113ef1e365309b0b465b1 to your computer and use it in GitHub Desktop.
Small testserver which serves the correct directory
package main
import (
"net/http"
"os"
"path/filepath"
)
const listen = "127.0.0.1:1337"
func main() {
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
println("Serving: " + dir + " at " + listen + "/")
http.ListenAndServe(listen, http.FileServer(http.Dir(dir)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment