ggPlays is a web application that allows users to view various video games, publish game reviews, and catalog games into game shelves that can be customized. This was inspired by Goodreads, a website where individuals can search for books, create reviews, catalog books into libraries, discuss all things books, and more.
Live link: ggPlays
- JavaScript
- HTML rendered through Pug templating
- CSS styling
- Favicon.io for favicon
- Adobe XD
- Hosted on Heroku
- Built with Express.js
- Uses a PostgreSQL Database
- Sequelize.js
- AJAX
- Express Validator Library
- CSURF Library
- Uses bcryptjs library to secure authentication
- Grants logged in users access to create reviews, store games, and view their profile
- Uses AJAX to asynchronously render elements like renaming or deleting a game shelf
- Prevents csrf attacks and uses validation forms to authenticate users
Found all gameshelves associated with the logged-in user. Gameshelf
includes the model Game
, Game
includes the model Genre
.
Then ordered the games queried by name/alphabetical order.
const shelves = await Gameshelf.findAll({
where: { user_id: userId },
include: [{
model: Game,
include: Genre
}],
order: [
[{model: Game}, 'name']
]
})
Each shelf has a corresponding ID, input value that we retrieved from req.body
Queried for the Gameshelf with the shelfId
the we retrieved from req.body
Set the title property of the shelf we queried for to the newName
(the value from req.body)
router.put('/', requireAuth, asyncHandler(async (req, res) => {
const { newName, shelfId } = req.body;
const customShelf = await Gameshelf.findByPk(shelfId);
customShelf.title = newName;
await customShelf.save();
res.json({ customShelf });
}))
Api Route to find a shelf by its ID and dynamically delete it on the current page, as well as delete all the associated games that belong to that shelf
// delete Gameshelf and any associated 'shelves' (games in the shelf)
router.delete('/delete', requireAuth, asyncHandler(async (req, res) => {
const { shelfId } = req.body;
const deleteGameshelf = await Gameshelf.findByPk(shelfId)
await deleteGameshelf.destroy();
res.status(204).end();
}))
- Search feature
- Delete game(s) from a game shelf
- Reputation score for reviewers