deadbeef.codes-publicfilese.../main.go

23 lines
401 B
Go

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() {
http.Handle("/", http.FileServer(http.Dir("public")))
log.Fatal(http.ListenAndServe(":8080", nil))
}()
log.Println("started public fileserver on 8080")
<-stop
log.Println("Shutting server down...")
}