Skip to content

Instantly share code, notes, and snippets.

@jethrokuan
Created March 27, 2016 05:20
Show Gist options
  • Save jethrokuan/7e14f8c539e471c16a24 to your computer and use it in GitHub Desktop.
Save jethrokuan/7e14f8c539e471c16a24 to your computer and use it in GitHub Desktop.
Simple Go Webserver
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
fmt.Println("Serving files in the current directory on port 3000")
http.Handle("/", http.FileServer(http.Dir(".")))
err := http.ListenAndServe(":3000", 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