-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (24 loc) · 606 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
"traintraingo/api"
"traintraingo/infra"
)
func main() {
var seatReservationService infra.SeatReservationAdapter
router := api.Routes(seatReservationService)
var gracefulStop = make(chan os.Signal)
signal.Notify(gracefulStop, syscall.SIGTERM)
signal.Notify(gracefulStop, syscall.SIGINT)
go func() {
sig := <-gracefulStop
fmt.Printf("Received signal '%+v' to stop the process gracefully\n", sig)
os.Exit(0)
}()
fmt.Println("Started server on localhost:8080. ctl+c to stop")
http.ListenAndServe(":8080", router)
}