Skip to content

Commit 59827d8

Browse files
committed
add deploy to heroku option
1 parent a25d75c commit 59827d8

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ Start the server locally by running
88

99
```
1010
yarn start:dev
11-
```
11+
```
12+
13+
## Deploy
14+
15+
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/socialgorithm/tic-tac-toe/tree/master)

app.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Tic Tac Toe Game Server",
3+
"description": "Tic Tac Toe Game Server",
4+
"repository": "https://github.com/socialgorithm/tic-tac-toe",
5+
"logo": "https://socialgorithm.org/assets/avatar.png",
6+
"keywords": ["tournament", "game", "socialgorithm"],
7+
"image": "heroku/nodejs",
8+
"env": {}
9+
}

dist/Server.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Server.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default class Server {
99
private gameServer: GameServer;
1010

1111
constructor(options: ServerOptions) {
12-
this.gameServer = new GameServer(this.onConnection, { port: options.port });
12+
const port = process.env.PORT ? parseInt( process.env.PORT, 10) : options.port || 5433;
13+
this.gameServer = new GameServer(this.onConnection, { port });
1314
}
1415

1516
private onConnection(bindings: GameBindings) {

0 commit comments

Comments
 (0)