|
9 | 9 | QUESTIONS_PER_PAGE = 10
|
10 | 10 |
|
11 | 11 | def create_app(test_config=None):
|
12 |
| - # create and configure the app |
13 |
| - app = Flask(__name__) |
14 |
| - setup_db(app) |
15 |
| - |
16 |
| - """ |
17 |
| - @TODO: Set up CORS. Allow '*' for origins. Delete the sample route after completing the TODOs |
18 |
| - """ |
19 |
| - |
20 |
| - """ |
21 |
| - @TODO: Use the after_request decorator to set Access-Control-Allow |
22 |
| - """ |
23 |
| - |
24 |
| - """ |
25 |
| - @TODO: |
26 |
| - Create an endpoint to handle GET requests |
27 |
| - for all available categories. |
28 |
| - """ |
29 |
| - |
30 |
| - |
31 |
| - """ |
32 |
| - @TODO: |
33 |
| - Create an endpoint to handle GET requests for questions, |
34 |
| - including pagination (every 10 questions). |
35 |
| - This endpoint should return a list of questions, |
36 |
| - number of total questions, current category, categories. |
37 |
| -
|
38 |
| - TEST: At this point, when you start the application |
39 |
| - you should see questions and categories generated, |
40 |
| - ten questions per page and pagination at the bottom of the screen for three pages. |
41 |
| - Clicking on the page numbers should update the questions. |
42 |
| - """ |
43 |
| - |
44 |
| - """ |
45 |
| - @TODO: |
46 |
| - Create an endpoint to DELETE question using a question ID. |
47 |
| -
|
48 |
| - TEST: When you click the trash icon next to a question, the question will be removed. |
49 |
| - This removal will persist in the database and when you refresh the page. |
50 |
| - """ |
51 |
| - |
52 |
| - """ |
53 |
| - @TODO: |
54 |
| - Create an endpoint to POST a new question, |
55 |
| - which will require the question and answer text, |
56 |
| - category, and difficulty score. |
57 |
| -
|
58 |
| - TEST: When you submit a question on the "Add" tab, |
59 |
| - the form will clear and the question will appear at the end of the last page |
60 |
| - of the questions list in the "List" tab. |
61 |
| - """ |
62 |
| - |
63 |
| - """ |
64 |
| - @TODO: |
65 |
| - Create a POST endpoint to get questions based on a search term. |
66 |
| - It should return any questions for whom the search term |
67 |
| - is a substring of the question. |
68 |
| -
|
69 |
| - TEST: Search by any phrase. The questions list will update to include |
70 |
| - only question that include that string within their question. |
71 |
| - Try using the word "title" to start. |
72 |
| - """ |
73 |
| - |
74 |
| - """ |
75 |
| - @TODO: |
76 |
| - Create a GET endpoint to get questions based on category. |
77 |
| -
|
78 |
| - TEST: In the "List" tab / main screen, clicking on one of the |
79 |
| - categories in the left column will cause only questions of that |
80 |
| - category to be shown. |
81 |
| - """ |
82 |
| - |
83 |
| - |
84 |
| - """ |
85 |
| - @TODO: |
86 |
| - Create a POST endpoint to get questions to play the quiz. |
87 |
| - This endpoint should take category and previous question parameters |
88 |
| - and return a random questions within the given category, |
89 |
| - if provided, and that is not one of the previous questions. |
90 |
| -
|
91 |
| - TEST: In the "Play" tab, after a user selects "All" or a category, |
92 |
| - one question at a time is displayed, the user is allowed to answer |
93 |
| - and shown whether they were correct or not. |
94 |
| - """ |
95 |
| - |
96 |
| - """ |
97 |
| - @TODO: |
98 |
| - Create error handlers for all expected errors |
99 |
| - including 404 and 422. |
100 |
| - """ |
101 |
| - |
102 |
| - return app |
| 12 | + # create and configure the app |
| 13 | + app = Flask(__name__) |
| 14 | + setup_db(app) |
| 15 | + |
| 16 | + """ |
| 17 | + @TODO: Set up CORS. Allow '*' for origins. Delete the sample route after completing the TODOs |
| 18 | + """ |
| 19 | + |
| 20 | + """ |
| 21 | + @TODO: Use the after_request decorator to set Access-Control-Allow |
| 22 | + """ |
| 23 | + |
| 24 | + """ |
| 25 | + @TODO: |
| 26 | + Create an endpoint to handle GET requests |
| 27 | + for all available categories. |
| 28 | + """ |
| 29 | + |
| 30 | + |
| 31 | + """ |
| 32 | + @TODO: |
| 33 | + Create an endpoint to handle GET requests for questions, |
| 34 | + including pagination (every 10 questions). |
| 35 | + This endpoint should return a list of questions, |
| 36 | + number of total questions, current category, categories. |
| 37 | +
|
| 38 | + TEST: At this point, when you start the application |
| 39 | + you should see questions and categories generated, |
| 40 | + ten questions per page and pagination at the bottom of the screen for three pages. |
| 41 | + Clicking on the page numbers should update the questions. |
| 42 | + """ |
| 43 | + |
| 44 | + """ |
| 45 | + @TODO: |
| 46 | + Create an endpoint to DELETE question using a question ID. |
| 47 | +
|
| 48 | + TEST: When you click the trash icon next to a question, the question will be removed. |
| 49 | + This removal will persist in the database and when you refresh the page. |
| 50 | + """ |
| 51 | + |
| 52 | + """ |
| 53 | + @TODO: |
| 54 | + Create an endpoint to POST a new question, |
| 55 | + which will require the question and answer text, |
| 56 | + category, and difficulty score. |
| 57 | +
|
| 58 | + TEST: When you submit a question on the "Add" tab, |
| 59 | + the form will clear and the question will appear at the end of the last page |
| 60 | + of the questions list in the "List" tab. |
| 61 | + """ |
| 62 | + |
| 63 | + """ |
| 64 | + @TODO: |
| 65 | + Create a POST endpoint to get questions based on a search term. |
| 66 | + It should return any questions for whom the search term |
| 67 | + is a substring of the question. |
| 68 | +
|
| 69 | + TEST: Search by any phrase. The questions list will update to include |
| 70 | + only question that include that string within their question. |
| 71 | + Try using the word "title" to start. |
| 72 | + """ |
| 73 | + |
| 74 | + """ |
| 75 | + @TODO: |
| 76 | + Create a GET endpoint to get questions based on category. |
| 77 | +
|
| 78 | + TEST: In the "List" tab / main screen, clicking on one of the |
| 79 | + categories in the left column will cause only questions of that |
| 80 | + category to be shown. |
| 81 | + """ |
| 82 | + |
| 83 | + """ |
| 84 | + @TODO: |
| 85 | + Create a POST endpoint to get questions to play the quiz. |
| 86 | + This endpoint should take category and previous question parameters |
| 87 | + and return a random questions within the given category, |
| 88 | + if provided, and that is not one of the previous questions. |
| 89 | +
|
| 90 | + TEST: In the "Play" tab, after a user selects "All" or a category, |
| 91 | + one question at a time is displayed, the user is allowed to answer |
| 92 | + and shown whether they were correct or not. |
| 93 | + """ |
| 94 | + |
| 95 | + """ |
| 96 | + @TODO: |
| 97 | + Create error handlers for all expected errors |
| 98 | + including 404 and 422. |
| 99 | + """ |
| 100 | + |
| 101 | + return app |
103 | 102 |
|
0 commit comments