Skip to content

Instantly share code, notes, and snippets.

@vdvm
Created June 30, 2014 08:34
Show Gist options
  • Save vdvm/a0ec0b8ad4950e2865c7 to your computer and use it in GitHub Desktop.
Save vdvm/a0ec0b8ad4950e2865c7 to your computer and use it in GitHub Desktop.
Simple HTTP server in Go
package main
import (
"log"
"net/http"
"os"
)
func main() {
cwd, _ := os.Getwd()
fs := http.FileServer(http.Dir(cwd))
//http.Handle("/", fs)
http.Handle("/static/", http.StripPrefix("/static/", fs))
log.Println("Serving " + cwd)
log.Println("Listening...")
http.ListenAndServe(":3000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment