21 lines
341 B
Go
21 lines
341 B
Go
|
//simple server
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
listen = flag.String("listen", ":8080", "listen address")
|
||
|
dir = flag.String("dir", ".", "directory to serve")
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
flag.Parse()
|
||
|
log.Printf("Listening on %q...", *listen)
|
||
|
log.Fatal(http.ListenAndServe(*listen, http.FileServer(http.Dir(*dir))))
|
||
|
}
|