2019-01-06 03:09:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
)
|
|
|
|
|
|
|
|
// http server setup and routing
|
|
|
|
func main() {
|
|
|
|
stop := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(stop, os.Interrupt)
|
|
|
|
go func() {
|
2019-01-06 03:58:40 +00:00
|
|
|
http.Handle("/", http.FileServer(http.Dir("public")))
|
2019-01-06 03:09:32 +00:00
|
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
|
|
}()
|
|
|
|
log.Println("started public fileserver on 8080")
|
|
|
|
|
|
|
|
<-stop
|
2020-04-05 00:39:26 +00:00
|
|
|
log.Println("Shutting server down...")
|
2019-01-06 03:09:32 +00:00
|
|
|
}
|