Created
March 27, 2016 05:20
-
-
Save jethrokuan/7e14f8c539e471c16a24 to your computer and use it in GitHub Desktop.
Simple Go Webserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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