GopherJS React gRPC-Web client
This folder contains the entire source for the frontend app hosted by the server.
It is written in GopherJS and leverages the GopherJS React bindings.
It performs server interactions via the interface exposed by the files in ./proto/
.
Those files are generated using protoc
and protoc-gen-gopherjs
. See protogen.sh
in
the root of this repo for the commands used.
This folder contains several subfolders, some of which are GopherJS packages, and some which
are part of the generation of the compiled fileserver.
The design of this client is heavily inspired by the
GopherJS React Examples Showcase.
Book
The book
package exposes GetBook
and QueryBooks
, two GopherJS React components that
themselves interface with the protoc-gen-go
generated interface in the proto
folder.
Compiled
The compiled
package is a vfsgen
generated package, created from the contents of
the html
folder. It serves as the interface that the main.go
server uses to serve
the GopherJS frontend without the need for a static
directory. The generation is done
via go:generate
in app.go
.
Container
The container
package exposes Container
, a GopherJS React component that creates the
base of the client. It draws a navbar, writes the header description and iterates over
the examples, fetching the source code and rendering the components for each.
html
The html
folder contains the static sources used, and during generation it also contains
the GopherJS generated javascript. They are removed after generation is complete as they're
just an intermediary to the final, compiled, vfsgen
go package. The favicon included
is borrowed from the grpc.github.io repo, and
subject to the LICENSE therein.
proto
The proto
package is generated by protoc-gen-gopherjs
. It also contains a ProtobufJS
generated file, with some slight modifications for compatibility and inclusion in the
generated JS file.