wx is an open-source framework that allows you to quickly build Go apps that use Svelte for rendering web pages.
This project was heavily inspired by bud. wx tries to be less opinionated about your Go app build process.
This project is at the very early stage. Do not use it for production! Wait until v1
is released.
go get github.com/apack/wx
go install github.com/apack/wx/cmd/...
Open your Go app folder and initialize views.
wx init
This will create files:
app
├── app.wx.go
├── components
│ ├── Button.svelte
│ └── Counter.svelte
├── gen.go
├── layouts
│ └── DefaultLayout.svelte
├── static
│ └── logo.svg
└── views
└── WelcomeView.svelte
NOTE: Every time you change these files run go generate ./app
.
Load your app and add handler.
package main
import (
"net/http"
"your/path/to/app"
"github.com/apack/wx"
)
func main() {
web := wx.NewRouter()
err := app.Load(web)
if err != nil {
panic(err)
}
web.HandleMethodFunc("GET", "/", handleWelcomeView())
http.ListenAndServe(":8080", web)
}
func handleWelcomeView() wx.HandlerFunc {
return func(ctx *wx.Context) error {
return ctx.View(app.WelcomeView, wx.Props{
"count": 111,
})
}
}
These are the main accomplishments that I want to release with future versions.
v0.1
- Donev0.2
- WIPv0.3
v0.4
v0.5
v0.6
v0.7
wx
.Project is not ready to accept contributors yet. Wait until v0.4
when all of the development documentation and CI is finished.
This work is based off the existing frameworks:
Copyright (c) 2022-present APack and Contributors. wx is free and open-source software licensed under the MIT License.
Third-party library licenses: