BORD


Nataliya Zhuravleva

Ryland Adams

Harrison Strand

Kevin Kirkley

Initiated January 25th, 2021
Released January 28th, 2021

Table of Contents

About the Project

Description

Have you ever entered a game store only to be stopped in your tracks by the immense collection, having no idea where to start? Bord is for you. In this program, the client side UI calls upon the Bord API to return review information about games that other Bord users have played and subsequently reviewed. The goal of this program is to provide its users with relative information that will help them find the board game that meets their needs.

Technologies Used

  • C#/.NET
  • API
  • MySQL
  • JavaScript
  • Html/Css
  • MySQL Workbench
  • Postman
  • VisualStudio Code
  • Git
  • GitHub

Known Bugs

Sometimes random gives an empty record (when query with at least two parameters). Works appropriately with ?random=true only parameter.

Installation Requirements

Required Technologies (see install instructions below)

  • C# .NET Core Ver 2.2.0
  • MySQL Ver 8.0.15 & MySQL Workbench
  • Modern Web Broswer
  • Postman (optional)
  • Text Editor (e.g.VisualStudio Code)

.NET Installation

Mac

  1. Download this .NET Core SDK (Software Development Kit) . Clicking this link will prompt a .pkg file download from Microsoft.
  2. Open the file. This will launch an installer which will walk you through installation steps. Use the default settings the installer suggests.
  3. Confirm the installation is successful by opening your terminal and running the command $ dotnet --version. You should see something like this in response: 2.2.105. This means both .NET and C# are successfully installed.

Windows

Note on Windows Versions These Windows instructions assume you're using Windows 10. If you currently run Windows 7 or Windows 8, you may have a free upgrade available. If you are not running Windows 10 (and cannot or do not plan to upgrade), specific installation steps may differ.

Installation Steps:

  1. Download either the the 64-bit .NET Core SDK (Software Development Kit). Clicking these links will prompt a .exe file download from Microsoft.
  2. Open the file and follow the steps provided by the installer for your OS.
  3. Confirm the installation is successful by opening a new Windows PowerShell window and running the command dotnet --version. You should see something a response like this: version numbers do not need to be the same: 2.2.105
    This means .NET and C# are installed and your computer recognizes the dotnet command.

MySQL Installation

Mac

  1. Download the MySQL Community Server .dmg file from the MySQL Community Server page. Click the download icon. Use the No thanks, just start my download link.
  2. Follow along with the Installer until you reach the Configuration page. Once you've reached Configuration, select or set the following options (use default if not specified):
    • Use Legacy Password Encryption.
    • Set password to epicodus.
    • Click Finish.
    • Open the terminal and enter the command echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile. This will save this path in .bash_profile, which is where our terminal is configured.
    • Type in source ~/.bash_profile (or restart the terminal) in order to actually verify that MySQL was installed.
  3. Verify MySQL installation by opening terminal and entering the command mysql -uroot -pepicodus. You'll know it's working and connected if you gain access and see the MySQL command line. If it's not working, you'll likely get a -bash: mysql: command not found error.
  4. You can exit the mysql program by entering exit.
  5. Download the MySQL Workbench .dmg file from the MySQL Workbench page. Use the No thanks, just start my download link.
  6. Install MySQL Workbench to Applications folder.
  7. Open MySQL Workbench and select the Local instance 3306 server. You will need to enter the password epicodus. If it connects, you're all set.

Windows

  1. Download the MySQL Web Installer from the MySQL Downloads page. Use the No thanks, just start my download link.
  2. _Follow along with the installer:
    • Click Yes if prompted to update.
    • Accept license terms.
    • Choose Custom setup type.
    • When prompted to Select Products and Features, choose the following:
      • MySQL Server 8.0.19 (This will be under MySQL Servers > MySQL Server > MySQL Server 8.0)
      • MySQL Workbench 8.0.19 (This will be under Applications > MySQL Workbench > MySQL Workbench 8.0)
    • Select Next, then Execute. Wait for download and installation. (This can take a few minutes.)
    • Advance through Configuration as follows:
      • High Availability set to Standalone.
      • Defaults are OK under Type and Networking.
      • Authentication Method set to Use Legacy Authentication Method.
      • Set password to epicodus.
      • Defaults are OK under Windows Service. Make sure that checkboxes are checked for the options Configure MySQL Server as a Windows Service and Start the MySQL Server at System Startup. Under Run Windows Service as..., the Standard System Account should be selected.
    • Complete Installation process.
  3. Add the MySQL environment variable to the System PATH. You must include MySQL in the System Environment Path Variable. This is its own multi-step process:
    • Open the Control Panel and visit System and Security > System. Select Change Settings and a pop-up window will display. Select the tab Advanced and select the Environment Variables button.
    • Within the System Variables navigator window, select PATH..., click Edit..., and then New.
    • Add the exact location of your MySQL installation, and click OK. (This location is likely C:\Program Files\MySQL\MySQL Server 8.0\bin, but may differ depending on your specific installation.)
  4. Verify installation by opening Windows PowerShell and entering the command mysql -uroot -pepicodus. You'll know it's working and connected if you gain access and see MySQL's command line. You can exit the mysql program by entering exit.
  5. Open MySQL Workbench and select the Local instance 3306 server (it may have a different name). You will need to enter the password epicodus. If it connects, you're all set.

Postman Installation (optional)

Download and install Postman from the Postman page.

Setup and Use

Cloning the project

  1. Navigate to the Bord.Solution repo at https://github.com/kevinkirkl3y/Bord.Solution to view the project files and commits.
  2. Click on the green button labeled Code to copy repository URL.
  3. Clone the repository to your local machine by opening your machine terminal and using the command git clone https://github.com/kevinkirkl3y/Bord.Solution.
  4. Navigate to the folder /Bord.Solution/BordAPI for Web API aspect of program.
  5. Navigate to the folder /Bord.Solution/BordClient for the Client side UI aspect of the program.

Downloading the project

  1. Navigate to my Bord.Solution repo at https://github.com/kevinkirkl3y/Bord.Solution to view the project files and commits.
  2. Click on the green button labeled Code to copy repository URL.
  3. Clone the repository to your local machine by opening your machine terminal and using the command git clone https://github.com/kevinkirkl3y/Bord.Solution.

App Settings

Database

  1. Open in the Bord.Solution/BordAPI/ directory the file named appsettings.json
  2. Change the server, port, and user id as necessary. Replace YourPassword with relevant MySQL password (set at installation of MySQL).
{
  "Logging": {
      "LogLevel": {
      "Default": "Warning"
      }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
      "DefaultConnection": "Server=localhost;Port=3306;database=bord_api;uid=root;pwd=YourPassword;"
  }
}

API Port Settings

  1. Open in the Bord.Solution/BordAPI/Properties directory the file named launchSettings.json
  2. Change the the localhosts as necessary. (Current Settings Below)
{
  ...
    "BordAPI": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "api/values",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  ...
}

Client Port Setting

  1. Open in the Bord.Solution/BordClient/Properties directory the file named launchSettings.json
  2. Change the the localhosts as necessary. (Current Settings Below)
{
  ...
    "BordAPI": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "api/values",
      "applicationUrl": "https://localhost:5003;http://localhost:5004",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  ...
}

Import Database Structure with Entity Framework Core

  1. Navigate to the /BordAPI directory in your terminal.
  2. Run the command dotnet ef database update which will use the mirgrations folder to create the MySQL Database using Entity Framework Core.
  3. (OPTIONAL) If you need to make adjustments to the database, use the command dotnet ef migrations add <NameOfNewMigration> and then run dotnet ef database update again to apply the changes.

Running Program

Run Application

  1. Navigate to the Bord.Solution/BordClient/ folder in the command line.
  2. Run the following command: $ dotnet restore
  3. Run the following command: $ dotnet build
  4. Run the following command to execute this compiled code: $ dotnet run
  5. Open browser to http://localhost:5003/ to access the UI.

Launch the API

  1. Navigate to Bord.Solution/BordAPI directory using the Terminal (e.g. cd Desktop/Bord.Solution/BordAPI).
  2. Run the following command: $ dotnet restore
  3. Run the following command: $ dotnet build
  4. Run the following command to execute this compiled code: $ dotnet run

API Documentation

End Points

Explore the API endpoints on in Postman. Base URL: https://localhost:5000

HTTP Request Structure

- GET /api/games
- POST /api/games
- GET /api/games/{id}
- PUT /api/games/{id}
- DELETE /api/games/{id}

Example Query

http://localhost:5000/api/Games/2

Examples of queries with parameters for Get Requests

You could query Games by these parameters:

  • GameName
  • MinPlayers
  • MaxPlayer
To query Game by name: http://localhost:5000/api/games?gamename=scrabble 
To query Game by minPlayers: http://localhost:5000/api/games?minplayers=2
To query Games by two parameters:http://localhost:5000/api/games?minplayers=2&&maxplayers=8

Games can also be queried at random or by a general search containing a fragment of the game name.

To get random Game: http://localhost:5000/api/games/?random=true
To search with fragment: http://localhost:5000/api/games?search=scr

Sample JSON Response

The following is the result for a query of http://localhost:5000/api/games/11

[
    {
        "gameId": 11,
        "gameName": "Chess",
        "gamePrice": 14.99,
        "minPlayers": 1,
        "maxPlayers": 2,
        "creators": "Unknown",
        "minAge": 4,
        "playTimeMin": 30,
        "genres": [
            {
                "gameGenreId": 11,
                "gameId": 11,
                "genreId": 2,
                "genre": {
                    "genreId": 2,
                    "genreName": "Strategy",
                    "games": []
                }
            }
        ],
        "reviews": [
            {
                "reviewId": 2,
                "title": "Oldie but goodie",
                "experience": "Shouldn't have watched queens gambit",
                "learningCurve": 8,
                "suggestion": "Study the greats",
                "gameId": 11
            }
        ]
    }
]

Contributors

Author GitHub Email
Nataliya Zhuravleva NataliyaZhuravleva natalindria@gmail.com
Ryland Adams Pugsly99 rylandadams@yahoo.com
Harrison Strand HarrisonStrand harrisonstrand@gmail.com
Kevin Kirkley kevinkirkl3y kevinmkirkley@gmail.com

License

This software is licensed under the MIT license

Copyright (c) 2020 Nataliya Zhuravleva, Ryland Adams, Harrison Strand, Kevin Kirkley