Skip to content

Instantly share code, notes, and snippets.

@lyricat
Created July 11, 2014 06:52
Show Gist options
  • Save lyricat/fedc27dfbd9a3c16cc27 to your computer and use it in GitHub Desktop.
Save lyricat/fedc27dfbd9a3c16cc27 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"net/http"
"os"
"strconv"
)
func main() {
rootPath, _ := os.Getwd()
http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir(rootPath))))
Run(4321)
}
func Run(port int) {
err := http.ListenAndServe(":"+strconv.Itoa(port), nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment