-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
64 lines (37 loc) · 971 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
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"gin_admin/pkg/settings"
"gin_admin/routes"
"github.com/fvbock/endless"
"log"
//"net/http"
_ "github.com/fvbock/endless"
"syscall"
//"../gin_admin/scripts"
)
func main(){
endless.DefaultReadTimeOut=settings.ReadTimeout
endless.DefaultWriteTimeOut=settings.WriteTimeout
endless.DefaultMaxHeaderBytes=1<<20
endPoint:=fmt.Sprintf(":%d",settings.HTTPPort)
server:=endless.NewServer(endPoint,routes.InitRouter())
server.BeforeBegin=func(add string){
log.Printf("Actual pid is %d",syscall.Getpid())
}
err:=server.ListenAndServe()
if err!=nil{
log.Print("Server err: %v",err)
}
//scripts.Select_One()
//r:=routes.InitRouter()
////_=r.Run("0.0.0.0:8080")
//s:=&http.Server{
// Addr: fmt.Sprintf(":%d", settings.HTTPPort),
// Handler: r,
// ReadTimeout: settings.ReadTimeout,
// WriteTimeout: settings.WriteTimeout,
// MaxHeaderBytes: 1<<20,
//}
//s.ListenAndServe()
}