-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
42 lines (34 loc) · 704 Bytes
/
main.go
File metadata and controls
42 lines (34 loc) · 704 Bytes
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
package main
import (
"fmt"
apiSystem "local/api/system"
apiUser "local/api/user"
mw "local/middleware"
"local/util"
"net/http"
"os"
"time"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
// init internal libs
if !util.Init() {
fmt.Println("fail to init")
//debug.PrintStack()
os.Exit(1)
}
// init web
e := echo.New()
e.Use(middleware.Recover())
e.Use(mw.RestLogger)
e.GET("/health", apiSystem.Health)
e.GET("/user", apiUser.Test)
//e.Use(mw.LoggerPost)
e.Any("/*", apiSystem.NotFound)
e.Logger.Fatal(e.StartServer(&http.Server{
Addr: ":1323",
ReadTimeout: 20 * time.Minute,
WriteTimeout: 20 * time.Minute,
}))
}