# Gamak
## Register
### Register Request
```js
POST /register
```
```json
{
"firstName": "مصیب",
"lastName": "ابراهیمی",
"username": "mosayyeb",
"email": "mosiaa.asdf@gmail.com",
"password": "1234(:",
"confirmPassword": "1234(:"
}
```
### Register Response
```js
200 Ok
```
```json
{
"msg" : "verification code sent",
"expireAt": 120
}
```
## Verify Account
### Verify Account Request
```js
POST /verify
```
```json
{
"username": "mosayyeb",
"code": "123456"
}
```
### Verify Account Response
```js
200 Ok
```
```json
{
"msg" : "verified",
"isVerified": true
}
```
## Login
### Login Request
```js
POST /login
```
```json
{
"username": "mosayyeb",
"password": "1234(:"
}
```
### Login Response
```js
200 Ok
```
```json
{
"msg" : "logged in",
"token": "ABCDEFGHJDDFDFDF45677766FFD$%$^&*sSDSD"
}
```
## Games
### get Games Request
```js
GET /games|?page=1|?limit=10|?include=comments,updater,owner
```
### get Games Response
```js
200 Ok
```
```json
{
"items": [
{
"id": 1,
"body": "you need to...",
"bodyMarkdown": "you need to...",
"dataPath" : "xua-SDc-dffc",
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"updatedBy": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updateAction": "create",
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"comments":[
{
"id" : 1,
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"root": null,
"body": "cool🔥",
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updatedById": 1,
"updateAction": "edit"
}
],
"isAccepted": false,
"like": 0,
"dislike" : 0,
"viewCount" : 0,
"commentCount" : 1
},
]
}
```
### get Single Game Request
```js
GET /games/{id}|?include=comments,updater,owner
```
### get Single Game Response
```js
200 Ok
```
```json
{
"id": 1,
"body": "you need to...",
"bodyMarkdown": "you need to...",
"dataPath" : "xua-SDc-dffc",
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"updatedBy": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updateAction": "create",
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"comments":[
{
"id" : 1,
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"body": "cool🔥",
"root": null,
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updatedById": 1,
"updateAction": "edit"
}
],
"isAccepted": false,
"like": 0,
"dislike" : 0,
"viewCount" : 0,
"commentCount" : 1
}
```
## Comments
### get Comments Request
```js
GET /comments|?page=1|?limit=10|?include=replies,updater,owner
```
### get Comments Response
```js
200 Ok
```
```json
{
"items" : [
{
"id" : 1,
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"root": null,
"body": "cool🔥",
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updatedById": 1,
"updateAction": "create",
"replies" : [
{
"id" : 34,
"createdAt": "2020-01-01T00:00:00.000Z",
"updatedAt": "2020-01-01T00:00:00.000Z",
"root": 1,
"body": "coool🔥",
"owner": {
"id": 1,
"username": "mosayyeb",
"firstName": "مصیب",
"lastName": "ابراهیمی",
"profilePic": "https://...",
},
"updatedById": 1,
"updateAction": "create",
}
]
}
]
}
```