Skip to content

Instantly share code, notes, and snippets.

@Akagi201
Forked from lyricat/web.go
Created July 11, 2014 12:32
Show Gist options
  • Save Akagi201/d2ac77d6bda813818bea to your computer and use it in GitHub Desktop.
Save Akagi201/d2ac77d6bda813818bea to your computer and use it in GitHub Desktop.
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)
}
}
@Akagi201
Copy link
Author

SimpleHTTPServer 性能太差了所以我用这个

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment