A darts scoring web app for playing real-time, online matches against your friends.
After creating a free account, you can create a game which will spit out a room code for you to join. Simply join this room and pass the code to your friend, and you're in! Currently only X01 is implemented, with more games on the way soon!
- React - Framework used to design the front-end UI
- Express - Back-end web application framework
- MongoDB - Database used to store required data
- Node.js - JavaScript run-time environment
- Socket.IO - Enables real-time, bidirectional and event-based communication
To run this application, you'll need:
-
Node.js & npm installed
-
A local installation of MongoDB:
If you have brew, install MongoDB with the following steps:
brew tap mongodb/brew
to add tapbrew install mongodb-community
to install MongoDBbrew services start mongodb-community
to start the MongoDB service (stop it withbrew services stop mongodb-community
)
The MongoDB URI, CookieKey, and Port keys can be added in a dev.js file in the ./config directory, see ./config/prod.js for an example of how to do this. There is a sample dev.js file provided, feel free to change the values in there to your liking.
If you're using a local install of MongoDB then you can set the MONGO URI key to something like
mongodb://localhost/my_database
. You do NOT need a MongoDB account to use this local method.
To get the frontend and backend run locally:
- Clone this repo
- Modify ./config/dev.js if desired (see Prerequisites for details)
npm install
to install all back-end required dependenciescd client
to navigate to front-end directorynpm install
to install all front-end required dependenciescd ..
to return back to the root directorynpm run dev
to start the local server
The front-end will run on port 3000 to prevent conflicts with the backend Express server which runs on port 5000 (customizable using the PORT environment variable).
To run the suite of Postman tests, download the .json file from inside the /tests
directory and import into your Postman client
❗ Currently only Postman testing is complete for all API routes. These are being moved to unit tests. Socket testing is being investigated.
The application provides an API in order to easily access some of the information stored on the database. The following endpoints are currently implemented:
Authentication Routes:
POST /auth/login
- sign in using username + password to an existing accountGET /auth/logout
- sign out of the currently signed in accountGET /auth/current_user
- get some basic info about currently signed in user (if any)
Game Routes:
GET /games?type_id=X01&?user_id=123
- Get public games (limited to at most 20 per query), if type_id is passedGET /games/:game_id
- Get the game with this idPOST /games/:type
- Create a game of this type, requires a gameConfig object to init the game withDEL /games/:game_id
- Delete the game with this id
User Routes:
POST /users/register
- Register for a new account with this username + passwordGET /users/:user_id
- Get user info of the specified userDEL /users/:user_id
- Delete the specified userPATCH /users/:user_id
- Update profile info of the specified userGET /users/:user_id/stats
- Get the profile statistics of this user
- Fork it (https://github.com/ErykBrol/DartsBuddy/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
- Eryk Brol - Project Developer - ErykBrol