|
| 1 | +Full Stack Trivia API "Udacitrivia" |
| 2 | +----- |
| 3 | + |
| 4 | +### Introduction |
| 5 | + |
| 6 | +Udacitrivia is a Full-Stack Web Application with following features: |
| 7 | + |
| 8 | +1) Display questions - both all questions and by category. Questions show the question, category and difficulty rating by default and can show/hide the answer. |
| 9 | +2) Delete questions. |
| 10 | +3) Add questions and require that they include question and answer text. |
| 11 | +4) Search for questions based on a text query string. |
| 12 | +5) Play the quiz game, randomizing either all questions or within a specific category. |
| 13 | + |
| 14 | +### Motiviation |
| 15 | + |
| 16 | +Main goal and motivation of the project is to learn how to design & develop an API which |
| 17 | +can be consumed by a seperat frontend and also from other, authorised sources. |
| 18 | + |
| 19 | +Every line of code was implemented with `Test-Driven-Development` in mind. Before a new Endpoint was |
| 20 | +created, I formulated and designed `Unit Tests` to check expected behaviour for successful and for bad requests. |
| 21 | + |
| 22 | +After all tests have been written, endpoints were implemented to pass exactly these tests. |
| 23 | + |
| 24 | +Development approach: |
| 25 | +1. Write & formulate test (= really think about desired outcomes and stuff that could go wrong) |
| 26 | +2. Fail test |
| 27 | +3. Write code |
| 28 | +4. Pass test (?) |
| 29 | +5. Refactor |
| 30 | + |
| 31 | +### Main Files: Project Structure |
| 32 | + |
| 33 | + ```sh |
| 34 | + ├── README.md |
| 35 | + ├── backend *** Contains API and test suit. |
| 36 | + │ ├── README.md *** Contains backend server setup and API documentation |
| 37 | + │ ├── config.py *** Contains information for database connection |
| 38 | + │ ├── models.py |
| 39 | + │ ├── flaskr |
| 40 | + │ │ └── __init__.py *** App creation & API endpoints. |
| 41 | + │ ├── requirements.txt *** The dependencies to be installed with "pip3 install -r requirements.txt" |
| 42 | + │ └── test_flaskr.py *** 22 unittests to check expected behaviour from API |
| 43 | + │ └── trivia.psql *** database dumb, restore with "psql trivia < trivia.psql" |
| 44 | + └── frontend *** start frontend with "npm start" |
| 45 | + ├── README.md *** Contains Frontend Setup |
| 46 | + └── src |
| 47 | + └── components *** Contains React Components |
| 48 | + ``` |
| 49 | + |
| 50 | +### Setup Project locally |
| 51 | + |
| 52 | +To start the project locally, you need to setup both `backend` and `frontend` seperatly. |
| 53 | +I suggest to start with the `backend` setup, because the `React-App` consumes the data from the `flask server`. |
| 54 | + |
| 55 | +1. [`./frontend/`](./frontend/README.md) |
| 56 | +2. [`./backend/`](./backend/README.md) |
0 commit comments