20 lines
306 B
Go
20 lines
306 B
Go
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
"os/signal"
|
||
|
|
|
||
|
|
"github.com/sirupsen/logrus"
|
||
|
|
"myschools.me/heritage/heritage-api/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
func main() {
|
||
|
|
gin.Service()
|
||
|
|
|
||
|
|
// 等待服务关闭信号,使用通道
|
||
|
|
quit := make(chan os.Signal, 1)
|
||
|
|
signal.Notify(quit, os.Interrupt)
|
||
|
|
<-quit
|
||
|
|
logrus.Info("Shutdown Server ...")
|
||
|
|
}
|