Created
July 11, 2014 06:52
-
-
Save lyricat/fedc27dfbd9a3c16cc27 to your computer and use it in GitHub Desktop.
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 ( | |
"log" | |
"net/http" | |
"os" | |
"strconv" | |
) | |
func main() { | |
rootPath, _ := os.Getwd() | |
http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir(rootPath)))) | |
Run(4321) | |
} | |
func Run(port int) { | |
err := http.ListenAndServe(":"+strconv.Itoa(port), 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