A simple hockey statistics analysis web app based on Node.js, Express.js, Jade, C3 Chart, and GetEventStore.
This is just a fun project during the journey of learning EventSourcing with GetEventStore, and modern web app development with Mean (MongoDB, Express, Angularjs, Node.js)
How to run the project:
-
Download the EventStore from https://geteventstore.com/.
-
Start the GetEventStore with the following command EventStore.ClusterNode.exe --db ./db --log ./logs –-start-standard-projections=true –-run-projections=all
-
Post events to EventStore (for each file in the data folder), e.g. for the game of 2015-10-23 curl –i –d @game_2015_10_23.json http://127.0.0.1:2113/streams/game-2015_10_23 -H “Content-Type:application/vnd.eventstore.events+json”
-
Add new projection in GetEventStore (for each file in the projections folder) Login to GetEventStore web console, click the Projections tab and click the "New Projection" button. Copy the content from file projection_game_stats.js and paste to the "Source" textbox, in the Name box enter a name you prefer, and choose "Continuous" in the Mode dropdown list, and check the "Emit Enabled" checkbox
-
Install Express: npm install express --save
-
Install Express Generator: npm install express-generator -g
-
Generate Application: express myhockeyapp
-
Install dependencies: npm install
-
Install C3 Chart: npm install c3-chart
-
Install Mongoose: npm install mongoose --save
-
Install Consolidate: npm install consolidate
-
Install Pug: npm install pug --save
-
Install Morgan: npm install morgan
-
Install Bower: npm install -g bower
-
Install Bower Components: 1). bower install bootstrap --save 2). bower install datatables --save 3). bower install datatables-plugins --save 4). bower install font-awesome --save 5). bower install holderjs --save 6). bower install metisMenu --save 7). bower install datatables-responsive --save 8). bower install bootstrap-social --save 9). bower install sb-admin-2 --save 10). bower install c3 --save 11). bower install d3 --save
-
Run the web app either from Visual Studio Code from Node.ss command line $ cd myhockeyapp $ node app.js
-
The url to check team stats: http://host:port/teamstats (e.g. http://localhost:3000/teamstats)
-
The url to check player stats: http://host:port/playerstats/12 (e.g. http://localhost:3000/playerstats/12)
-
Jade variable doesn't work in tag input's value attribute, e.g. the following statment won't work input#streamId(type="hidden" value="#{stream_id}") however we can use the html tag <input type="hidden" name="streamId" id ="streamId", value="#{stream_id}">