Humble + GopherJS • TodoMVC
Humble is a collection of loosely-coupled tools designed to build client-side and hybrid web applications using GopherJS, which compiles Go code to JavaScript.
- Website
- Documentation (Each package is documented separately)
Let us know if you discover anything worth sharing.
A Live Demo of the application is available online.
GopherJS compiles Go to JavaScript code which can run in the browser. Humble is a collection of tools written in Go designed to be compatible with GopherJS.
The following Humble packages are used:
- router for handling the
/active
and/completed
routes. - locstor for saving todos to localStorage.
- temple for managing Go templates and packaging them so they can run in the browser.
- view for organizing views, doing basic DOM manipulation, and delegating events.
The full TodoMVC spec is implemented, including routes.
First, install Go. You will also need to setup your
Go workspace. It is important that you have
an environment variable called GOPATH
which points to the directory where all
your Go code resides.
To download and install this repository, run
go get github.com/go-humble/examples
, which will place the project in
$GOPATH/src/github.com/go-humble/examples
on your machine.
You will also need to install GopherJS with
go get -u github.com/gopherjs/gopherjs
. The -u
flag gets the latest version,
which is recommended.
The project uses temple to precompile
templates. Install temple with go get -u github.com/go-humble/temple
.
Then run go generate ./...
to compile the templates and compile the Go code
to JavaScript.
Finally, serve the project directory with go run serve.go
and visit
localhost:8000 in your browser.
Created by Alex Browne