22 lines
332 B
Go
22 lines
332 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
addr := flag.String("addr", ":3000", "listen address")
|
||
|
flag.Parse()
|
||
|
|
||
|
fs := http.FileServer(http.Dir("./"))
|
||
|
http.Handle("/", fs)
|
||
|
|
||
|
log.Print("Listening on http://" + *addr + "/ ...")
|
||
|
err := http.ListenAndServe(*addr, nil)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|