5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 22:49:31 +08:00
wails/v3/examples/gin-service/main.go
Lea Anthony b72782c35d
Update docs + examples.
Serve runtime from assetserver if requested.
2025-03-11 08:50:03 +11:00

46 lines
909 B
Go

package main
import (
"embed"
"log/slog"
"os"
"gin-service/services"
"github.com/wailsapp/wails/v3/pkg/application"
)
//go:embed assets/*
var assets embed.FS
func main() {
app := application.New(application.Options{
Name: "Gin Service Demo",
Description: "A demo of using Gin in Wails services",
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
LogLevel: slog.LevelDebug,
Services: []application.Service{
application.NewServiceWithOptions(services.NewGinService(), application.ServiceOptions{
Route: "/api",
}),
},
Assets: application.AssetOptions{
Handler: application.BundledAssetFileServer(assets),
},
})
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Gin Service Demo",
Width: 1024,
Height: 768,
})
err := app.Run()
if err != nil {
println(err.Error())
os.Exit(1)
}
}