Skip to content

Instantly share code, notes, and snippets.

@jethrokuan
Created March 27, 2016 05:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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