Skip to content

Commit 86f44f2

Browse files
committed
Restructuring for deployment
1 parent b95bd3a commit 86f44f2

26 files changed

+2862
-2
lines changed

Godeps/Godeps.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/Readme

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: go-react-chat

app/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class App extends Component {
2828
}
2929

3030
// init client websocket
31-
socket = new WebSocket(`ws://127.0.0.1:8081/ws?name=${input}`);
31+
socket = new WebSocket(`ws://${document.location.host}/ws?name=${input}`);
3232
socket.onopen = (event) => {
3333
console.log('Opened socket');
3434
};
File renamed without changes.

server/main.go renamed to main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ func main() {
1111
// start conn_hub
1212
hub := newConnHub()
1313
go hub.run()
14-
14+
// serve create-react-app-bundle
15+
fs := http.FileServer(http.Dir("./app/build"))
16+
http.Handle("/", fs)
17+
// serve websocket route
1518
http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
1619
wsHandler(hub, w, r)
1720
})
21+
// start server
1822
err := http.ListenAndServe(":8081", nil)
1923
if err != nil {
2024
fmt.Println("ListenAndServeError:", err)

vendor/github.com/gorilla/websocket/.gitignore

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gorilla/websocket/.travis.yml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gorilla/websocket/AUTHORS

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gorilla/websocket/LICENSE

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/gorilla/websocket/README.md

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)