-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (30 loc) · 848 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
package main
import (
"log"
"time"
"github.com/patarapolw/webview-server/desktop"
"github.com/patarapolw/webview-server/file"
"github.com/patarapolw/webview-server/server"
)
func main() {
handlers := server.CreateServer()
file.BindRoutes(handlers.API.Group("/file"), handlers.Config.Root)
// Enable SQLite routes and compile to make it work for you
// sqlite.BindRoutes(handlers.API.Group("/sqlite"), handlers.Config.Sqlite)
// It is also possible to run without desktop, via
/*
signals := make(chan os.Signal, 1)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
go func() {
<-signals
OnExit()
}()
handlers.Serve()
*/
// Or just create your own Gin server
desktop.Init(handlers, func() {
log.Println("Executing clean-up function")
time.Sleep(1 * time.Second)
log.Println("Clean-up finished")
})
}