Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
set readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahwaheed committed Sep 24, 2021
1 parent d8fa291 commit d16a480
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Trivia API
# Trivia APP

### Installing Dependencies for the Backend

Expand Down Expand Up @@ -51,7 +51,30 @@ To run the tests, run
dropdb trivia_test
createdb trivia_test
psql trivia_test < trivia.psql
python test_flaskr.py
python test_app.py
```

## Enviroment
To set up environmemnt variables, create a file named .env. Here is the template
```
DB_NAME=<DB_NAME>
DB_USER=<DB_USER>
DB_PASSWORD=<DB_PASSWORD>
DB_HOST=<DB_HOST>
```

## Roles and Permissions

### Admin Role
```
post:question
patch:question
delete:question
play:quiz
```
### User Role
```
play:quiz
```


Expand Down Expand Up @@ -179,3 +202,27 @@ POST '/questions'
'currentCategory': 'Entertainment'
}
```
```js
PATCH '/questions/${id}'
- Sends a patch request to update a specific question with given values
- Request Body:
{
'difficulty': 3,
'category': 1,
}
- Returns: any object of question
{
'questions': [
{
'id': 1,
'question': 'This is a question',
'answer': 'This is an answer',
'difficulty': 5,
'category': 5
},
],
'totalQuestions': 100,
'currentCategory': 'Entertainment'
}
```
2 changes: 1 addition & 1 deletion test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from flask_sqlalchemy import SQLAlchemy
from werkzeug.wrappers import request

from flaskr import create_app
from app import create_app
from models import setup_db, Question, Category
from settings import DB_NAME, DB_HOST, DB_USER, DB_PASSWORD

Expand Down

0 comments on commit d16a480

Please sign in to comment.