Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.04 KB

README.md

File metadata and controls

67 lines (45 loc) · 1.04 KB

Go WASM

Toolkit for building web apps with Go and WebAssembly.

Modular packages, supports building virtual dom nodes with a hyperscript style api, rendering to HTML string on the server, and DOM elements in the browser.

Features:

  • virtual dom (with patching and possible hydration)
  • hyperscript
  • server-side rendering
  • routing

Getting Started

Install dependencies:

$ go get github.com/speier/gowasm

Write a component:

package main

import (
	"github.com/speier/gowasm/pkg/dom"
	"github.com/speier/gowasm/pkg/vdom"
)

func main() {
	view := vdom.H("div", nil,
		vdom.H("h1", nil, vdom.Text("Hello World!")),
	)

	dom.Render(view, dom.QuerySelector("body"))
}

Run with dev server:

$ gowasm serve

Examples

To run the basic example with dev server:

$ gowasm serve examples/basic

To run the isomorphic example:

# generate wasm
$ go generate ./examples/isomorphic/...
# run the server
$ go run examples/isomorphic/server.go

License

MIT