API implemented for use with Game Galaxy application. API gives the user the ability to login, authenticate, create folders, and search/save games to their profile. The coordination between this API and the Game Galaxy client allows users to create a profile with folders containing their saved games, and allows users to check games off when they are completed. the IGDB 3rd party API is utilized to allow the users to search their large database of games.
Node.js, Express.js and Express Router, JavaScript, PostgreSQL, Supertest, Knex.js
Authentication implemented utilizing JWT authentication. Users log in with username and password, and a user_id is assigned upon creation. Added folders and beers by each user are associated with the respective user's user_id.
https://gamegalaxyapi.herokuapp.com/
Returns all beers associated with a user_id number, given in the request header. Response is an array of games in JSON format.
Posts a game to a database with information stored in game instance (received from IGDB server). Adds on associated user_id to request body, which is retrieved from session storage.
Example POST request format:
{
"title": "Halo 4",
"igdb_id": "123",
"completed": "false",
"folder_id": "1",
"user_id": "1"
}
Deletes a game from the database, accessing the game via the game's ID property, passed via request parameter.
Updates a game's completed status to either true or false, depending on the value included in the request body.
Example PATCH request body:
{
"completed": "true"
}
Retrieves all folders from the database associated with the user_id passed via the request headers.
Gets a specific folder from the database. Folder is retrived via a unique folder ID, passed via request parameters.
Posts a folder to the database. Adds user's associated user_id, retrieved from session storage.
Example POST request body:
{
"name": "Test Folder",
"user_id": "1"
}
Removes a folder from the database. Pinpoints a folder via the folder's unique ID, passed to the API via the request parameters.
Registers a user in the database. Users are assigned a unique user_id property upon creation in the database.
Example POST request body:
{
"user_name": "testuser",
"password": "!Testpassword1"
}
Validates user's sign in input, attempts to match to values in the database. Input password is compared with hashed values in the database. If successful, JWT is created for the user's session and stored in browser's session storage.
Example POST request for login authentication:
{
"user_name": "testuser",
"password": "!Testpassword1"
}