rest-api/main.go
Piotr Biernat e1019a5ecc
All checks were successful
continuous-integration/drone/push Build is passing
Some refactor. Rewritted to Echo Framework
2020-09-26 23:01:44 +02:00

29 lines
435 B
Go

package main
import (
"context"
"go-rest-api/server"
"log"
"os"
"os/signal"
"time"
)
func main() {
s := server.NewServer(":8000")
go func() {
s.Serve()
}()
signCh := make(chan os.Signal)
signal.Notify(signCh, os.Interrupt)
signal.Notify(signCh, os.Kill)
sig := <-signCh
log.Println("Received terminal, graceful shutdown", sig)
tc, _ := context.WithTimeout(context.Background(), 30*time.Second)
s.Shutdown(tc)
}