Skip to content

Instantly share code, notes, and snippets.

@chespinoza
Created July 30, 2013 03:00
Show Gist options
  • Save chespinoza/6109848 to your computer and use it in GitHub Desktop.
Save chespinoza/6109848 to your computer and use it in GitHub Desktop.
Tiny Web Server with Go
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