Created
July 30, 2013 03:00
-
-
Save chespinoza/6109848 to your computer and use it in GitHub Desktop.
Tiny Web 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 ( | |
//"fmt" | |
"log" | |
"net/http" | |
"time" | |
) | |
const ( | |
LADDR = ":8080" | |
) | |
func main() { | |
srv := &http.Server{ | |
Addr: LADDR, | |
ReadTimeout: 30 * time.Second, | |
WriteTimeout: 30 * time.Second, | |
} | |
http.Handle("/", http.FileServer(http.Dir("./"))) | |
log.Fatal(srv.ListenAndServe()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment