enter the live site here
bored gamer will help you pick the right game for your next game night. It is built using the following:
- Backend: MongoDB, Express.js, Node.js, Mongoose
- Frontend: React.js, Redux, Axios, SCSS
- Hosting: Heroku
User Authentication
Users can create and log in to their accounts, with validations and errors rendered as applicable. For those simply wanting to check out the functionality, there is a demo user option available.
Game Index
With a lot of games to choose from, users may view all games by simply scrolling down on the main page. New games are fetched and loaded by the time they scroll down, so they can pick a game that catches their eye. Implemented with scroll event handler and pertinent Axios calls.
Categories / Mechanics
Users may sort by categories and mechanics to find the best fit for them. The game index updates according to the selected checkboxes, with a live count of the number of games rendered under the given restrictions.
Game Show
Users may select a game, leading to its' show page. Each game holds important information, including ratings, play time, and more. The user also has the option to rate it themselves after they've played.
Game Likes
When a user submits a review it can be seen in the like index for this game. Full CRUD operations are available on their likes, allowing for users to post, view, update, and delete their reviews.
User Profile
router.get("/:userId/likes", (req, res) => {
const dislike = req.query.dislike === "true";
const userId = req.params.userId;
User.aggregate(
[
{
$match: {
_id: new ObjectId(userId),
},
},
{
$unwind: {
path: "$likes",
preserveNullAndEmptyArrays: true,
},
},
{
$match: {
"likes.dislike": dislike,
},
},
{
$lookup: {
from: "games",
localField: "likes.gameId",
foreignField: "_id",
as: "game",
},
},
],
function (err, data) {
if (err) {
throw err;
} else {
const formattedData = data.map(user => {
const newLike = {};
newLike.review = user.likes.review;
newLike.game = user.game[0];
return newLike;
});
return res.json(formattedData);
}
});
})
Games that the user has rated or added to their collection will appear on their profile, allowing them easy access to games they've enjoyed. This code snippet shows how all the likes for a user are accessed by the dislike flag. These likes are then joined to the games collection and formatted for the frontend to receive.
by Jimmy Collins, Jen Lu, and Naveen Thota