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
22
33import (
44 "github.com/g3force/ssl-game-controller/internal/app/controller"
5+ "github.com/gobuffalo/packr"
56 "net/http"
67)
78
@@ -10,8 +11,9 @@ func main() {
1011 g := controller .NewGameController ()
1112 g .Run ()
1213
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+
1517 // serve the bidirectional web socket
1618 http .HandleFunc ("/ws" , g .ApiServer .WsHandler )
1719 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