Created
October 30, 2014 15:24
-
-
Save gliheng/13988e03519bc1aaaeb8 to your computer and use it in GitHub Desktop.
fast static http server with go
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 ( | |
"os" | |
"log" | |
"net/http" | |
) | |
func main() { | |
port := "8000" | |
log.Println("Listening on port", port) | |
pwd, _ := os.Getwd() | |
http.Handle("/", http.FileServer(http.Dir(pwd))) | |
log.Fatal(http.ListenAndServe(":" + port, nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment