Created
April 28, 2017 20:50
-
-
Save warpfork/1cef292935d3c4873ac54d8e6897b0e9 to your computer and use it in GitHub Desktop.
wob wob wob
This file contains hidden or 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 | |
// the command you are looking for is probably: git update-server-info | |
import ( | |
"fmt" | |
"os" | |
"net/http" | |
) | |
func handler(resp http.ResponseWriter, req *http.Request) { | |
fmt.Printf("serving \"%s\"\n", req.URL.Path) | |
http.ServeFile(resp, req, req.URL.Path[1:]) | |
} | |
func main() { | |
http.HandleFunc("/", handler) | |
var port string; if len(os.Args) > 1 { port = os.Args[1] } else { port = "80" } | |
fmt.Printf("Starting server on port "+port+"\n") | |
if err := http.ListenAndServe(":"+port, nil); err != nil { | |
fmt.Printf(err.Error()+"\n") | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment