You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Directory where the static built embeded app resides (default "/react-app/build/")
25
27
-proxy string
26
28
Address to proxy requests to (default "http://localhost:3000/")
27
29
```
@@ -66,7 +68,7 @@ go run main.go -mode dir
66
68
```
67
69
68
70
69
-
### Embed mode
71
+
### Packaged mode (pre 1.16)
70
72
71
73
This method will build the react code into a deployment/production version, then embed it in the binary. This means you only need to produce a single binary for distribution without needing to deploy the react code as well. I find this very useful for programs that need a user interface but dont want the heft of a full update system.
72
74
@@ -93,11 +95,31 @@ Build and run the binary
93
95
```
94
96
go build -o go-react main.go pkged.go
95
97
96
-
./go-react -mode embed
98
+
./go-react -mode pkger
97
99
98
100
```
99
101
100
102
Alternatively, the Makefile has all these steps:
101
103
```
102
104
make run
103
-
```
105
+
```
106
+
107
+
### Embed mode (1.16+)
108
+
109
+
This provides the same methods as the packager method, but uses the new 1.16+ interface.
110
+
111
+
First, build the react code into a deployment/production version
112
+
113
+
```
114
+
cd react-app/
115
+
npm build
116
+
```
117
+
118
+
Next, run the code. The files are automatically embeded.
0 commit comments