Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
# GameGrid Server

## Project Description

This is the backend server for GameGrid, a social network for gamers. It handles all server-side logic, data storage, and API endpoints for the client application.

## How to Install

### Requirements

- Node.js (v14 or higher)
- npm (v6 or higher)
- Git

### Installation
1. Clone the repository:
```sh
git clone https://github.com/GameGrid-Team/gamegrid-server
cd gamegrid-server
```

1. Clone the repository(branch should be main):

```sh
git clone https://github.com/GameGrid-Team/gamegrid-server
cd gamegrid-server
```

2. Install dependencies:
```sh
npm install
```
```sh
npm install
```

### Running the Server

1. Start the server using nodemon:
```sh
npm run dev
```

```sh
npm run dev
```

2. The server should now be running on `http://localhost:3001`.

### Linting and Testing

1. Run ESLint:
```sh
npm run lint
```

```sh
npm run lint
```

2. Run tests:
```sh
npx cypress run
```
```sh
npx cypress run
```
3 changes: 3 additions & 0 deletions routes/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ module.exports = (db) => {
}
post.likes.users.push(userId)
postCreator.social.rank.exp += 1
postCreator.social.total_likes += 1
postCreator.social.rank = general.checkRank(postCreator.social.rank.exp)
postDB.updateOne({ _id: new ObjectId(postId) }, { $set: post })
usersDB.updateOne({ _id: new ObjectId(post.user_id) }, { $set: postCreator })
Expand Down Expand Up @@ -314,6 +315,7 @@ module.exports = (db) => {
}
post.saves.users.push(userId)
postCreator.social.rank.exp += 3
postCreator.social.total_saves += 1
postCreator.social.rank = general.checkRank(postCreator.social.rank.exp)
postDB.updateOne({ _id: new ObjectId(postId) }, { $set: post })
usersDB.updateOne({ _id: new ObjectId(post.user_id) }, { $set: postCreator })
Expand Down Expand Up @@ -438,6 +440,7 @@ module.exports = (db) => {
.findOne(originalOwner)
.then((user) => {
user.social.rank.exp += 4
user.social.total_share += 1
user.social.rank = general.checkRank(user.social.rank.exp)
usersDB.updateOne(originalOwner, { $set: user })
postBody.shared = true
Expand Down