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

24 lines
445 B
Go
Raw Normal View History

2019-01-06 03:09:32 +00:00
package main
import (
"fmt"
"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("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir("public"))))
log.Fatal(http.ListenAndServe(":8080", nil))
}()
log.Println("started public fileserver on 8080")
<-stop
fmt.Println("Shutting server down...")
}