Skip to content

speier/gowasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published