rove/cmd/rove-server/main.go
Marc Di Luzio 73a1e1fd21 Housekeeping
Move docs and commands out into their own files
2020-05-30 22:46:53 +01:00

35 lines
546 B
Go

package main
import (
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
)
func main() {
fmt.Println("Initialising...")
// Set up the close handler
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
fmt.Println("SIGTERM recieved, exiting...")
os.Exit(0)
}()
// Create a new router
router := NewRouter()
fmt.Println("Initialised")
// Listen and serve the http requests
fmt.Println("Serving HTTP")
if err := http.ListenAndServe(":80", router); err != nil {
log.Fatal(err)
}
}