-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
49 lines (37 loc) · 829 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
45
46
47
48
49
package main
import (
_ "embed"
"os"
"github.com/gin-gonic/gin"
"github.com/gopher-lego/ginger/route"
"github.com/spf13/viper"
"github.com/gopher-lego/ginger/config"
)
/**
* $ go run main.go bindata.go
* $ curl -X GET -d "s=a" http://localhost:8090/api/ping
*/
func main() {
// Load configure file
config.InitConfAsset(mainPath, bytesContent)
// config.MySqlInit()
// Memory cache
config.NewFreeCache()
// simple single-node memory cache
config.NewGoCache()
// Framework engine
engine := gin.Default()
// Routes
route.Set(engine)
// Run
err := engine.Run(viper.GetString("server.port")) // listen and serve on 0.0.0.0:port
if err != nil {
panic(err.Error())
}
}
var mainPath = func() string {
pwd, _ := os.Getwd()
return pwd
}()
//go:embed setting/app.release.json
var bytesContent []byte