A demo project showing how to use GopherJS to share Go code between Go and JS applications
gopherjs as a command line tool
go get -u github.com/gopherjs/gopherjs
A simple example of a Go struct being exported for use in JS code.
cd pet/js gopherjs build main.go node index.js
A more complex example of a Go library that could be reused between Go and JS applications.
Note that, for brevity's sake, the
user example does not include as much type checking as it should.
RegisterDBJS(jsdb) should check that
jsdb really does include a
To test in Go:
cd user/go go run main.go
To test in NodeJS:
cd user/js gopherjs build main.go node index.js