diff --git a/README.md b/README.md index f903695..e45c9c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Trivia API +# Trivia APP ### Installing Dependencies for the Backend @@ -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_USER= +DB_PASSWORD= +DB_HOST= +``` + +## Roles and Permissions + +### Admin Role +``` +post:question +patch:question +delete:question +play:quiz +``` +### User Role +``` +play:quiz ``` @@ -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' +} +``` diff --git a/test_app.py b/test_app.py index 84d29d1..bb7d189 100644 --- a/test_app.py +++ b/test_app.py @@ -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