-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
56 lines (45 loc) · 1.01 KB
/
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
50
51
52
53
54
55
56
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/jinzhu/gorm"
"github.com/leaanthony/mewn"
"github.com/wailsapp/wails"
"driving_school/backend"
_ "github.com/mattn/go-sqlite3"
)
var folderName = "auto-ecole/"
var databaseDirectory = folderName + "db"
var databaseFileName = "db.sqlite3"
func main() {
path := filepath.Join(
service.GetRootDir(),
databaseDirectory,
)
if err := service.CreateDatabaseDirFile(databaseDirectory,
databaseFileName); err != nil {
fmt.Println(err)
os.Exit(1)
}
db, err := gorm.Open("sqlite3", filepath.Join(path, databaseFileName))
if err != nil {
fmt.Println(err)
os.Exit(1)
}
service.InitService(db)
defer service.CloseService()
service := service.MainService
js := mewn.String("./frontend/dist/app.js")
css := mewn.String("./frontend/dist/app.css")
app := wails.CreateApp(&wails.AppConfig{
Width: 1280,
Height: 720,
Title: "Auto école Noureddine",
JS: js,
CSS: css,
Colour: "#131313",
})
app.Bind(service)
app.Run()
}