File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"github.com/g3force/ssl-game-controller/internal/app/controller"
5
+ "github.com/gobuffalo/packr"
5
6
"net/http"
6
7
)
7
8
@@ -10,8 +11,9 @@ func main() {
10
11
g := controller .NewGameController ()
11
12
g .Run ()
12
13
13
- // serve the static resource of UI (for production use only)
14
- http .Handle ("/" , http .FileServer (http .Dir ("." )))
14
+ box := packr .NewBox ("../../ui/dist" )
15
+ http .Handle ("/" , http .FileServer (box ))
16
+
15
17
// serve the bidirectional web socket
16
18
http .HandleFunc ("/ws" , g .ApiServer .WsHandler )
17
19
http .ListenAndServe (":8081" , nil )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # stop on errors
4
+ set -e
5
+
6
+ echo " Build UI for production"
7
+ cd ui
8
+ npm run build
9
+ cd ..
10
+
11
+ echo " Build backend and include static UI files with packr into binary"
12
+ cd cmd/ssl-game-controller
13
+ packr install
14
+
15
+ if [ -z " ${GOPATH} " ]; then
16
+ GOPATH=" ~/go"
17
+ fi
18
+ echo " Self-contained binary can be found here: ${GOPATH} /bin/ssl-game-controller"
You can’t perform that action at this time.
0 commit comments