A demo project showing how to use GopherJS to share Go code between Go and JS applications
Go JavaScript
Switch branches/tags
Nothing to show
Clone or download
Latest commit 3d4ee63 Mar 7, 2015
Permalink
Failed to load latest commit information.
pet Created gopherjs examples Mar 7, 2015
user Created gopherjs examples Mar 7, 2015
.gitignore Created gopherjs examples Mar 7, 2015
LICENSE Initial commit Mar 6, 2015
README.md Updated README Mar 7, 2015

README.md

gopherjs-demo

A demo project showing how to use GopherJS to share Go code between Go and JS applications

Setup

Install gopherjs as a command line tool

go get -u github.com/gopherjs/gopherjs

pet

A simple example of a Go struct being exported for use in JS code.

cd pet/js
gopherjs build main.go  
node index.js

user

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. For example, RegisterDBJS(jsdb) should check that jsdb really does include a Query() function.

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