It is highly recommend to use in real world projects go-starter-kit. This project done right and contains some good wins for rapid development of efficient applications.
This is an example of project which shows how to render React app on Golang server-side.
It’s very similar to andreypopp/react-quickstart(please see it first) project, but with some Go and other benefits.
What it contains?
- gin framework
- staticbin middleware for gin, to serve embedded static files
- config package, to define config, parse flags and environment variables
- [optional] live code reloading, by
fswatch, avilable for OSX and linux
Also this project allows you to embed all static files. So, you have one executable file of you application.
$ git clone https://github.com/olebedev/go-react-example $ cd go-react-example $ go get ./... $ go get -u github.com/jteeuwen/go-bindata/... $ npm i
Now you ready to start.
$ make $ go run *.go
If you have
fswatch, you can type this
make serveand project will be reloaded every time when you change any of
fswatchis avilable for OSX and linux.