{"id":31846849,"url":"https://github.com/debugwithshubham/02_trivia_api","last_synced_at":"2025-10-12T09:16:52.156Z","repository":{"id":52152359,"uuid":"264519933","full_name":"debugwithshubham/02_trivia_api","owner":"debugwithshubham","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-02T06:45:15.000Z","size":174,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-20T06:25:10.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/debugwithshubham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-16T20:19:43.000Z","updated_at":"2020-05-16T20:23:23.000Z","dependencies_parsed_at":"2023-02-17T15:45:59.811Z","dependency_job_id":null,"html_url":"https://github.com/debugwithshubham/02_trivia_api","commit_stats":null,"previous_names":["debugwithshubham/02_trivia_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/debugwithshubham/02_trivia_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugwithshubham%2F02_trivia_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugwithshubham%2F02_trivia_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugwithshubham%2F02_trivia_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugwithshubham%2F02_trivia_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/debugwithshubham","download_url":"https://codeload.github.com/debugwithshubham/02_trivia_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/debugwithshubham%2F02_trivia_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010967,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-12T09:16:50.804Z","updated_at":"2025-10-12T09:16:52.145Z","avatar_url":"https://github.com/debugwithshubham.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Full Stack Trivia API Backend\n\n## Getting Started\n\n### Installing Dependencies\n\n#### Python 3.7\n\nFollow instructions to install the latest version of python for your platform in the [python docs](https://docs.python.org/3/using/unix.html#getting-and-installing-the-latest-version-of-python)\n\n#### Virtual Enviornment\n\nWe recommend working within a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organaized. Instructions for setting up a virual enviornment for your platform can be found in the [python docs](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)\n\n#### PIP Dependencies\n\nOnce you have your virtual environment setup and running, install dependencies by naviging to the `/backend` directory and running:\n\n```bash\npip install -r requirements.txt\n```\n\nThis will install all of the required packages we selected within the `requirements.txt` file.\n\n##### Key Dependencies\n\n- [Flask](http://flask.pocoo.org/)  is a lightweight backend microservices framework. Flask is required to handle requests and responses.\n\n- [SQLAlchemy](https://www.sqlalchemy.org/) is the Python SQL toolkit and ORM we'll use handle the lightweight sqlite database. You'll primarily work in app.py and can reference models.py. \n\n- [Flask-CORS](https://flask-cors.readthedocs.io/en/latest/#) is the extension we'll use to handle cross origin requests from our frontend server. \n\n## Database Setup\nWith Postgres running, restore a database using the trivia.psql file provided. From the backend folder in terminal run:\n```bash\npsql trivia \u003c trivia.psql\n```\n\n## Running the server\n\nFrom within the `backend` directory first ensure you are working using your created virtual environment.\n\nTo run the server, execute:\n\n```bash\nexport FLASK_APP=flaskr\nexport FLASK_ENV=development\nflask run\n```\n\nSetting the `FLASK_ENV` variable to `development` will detect file changes and restart the server automatically.\n\nSetting the `FLASK_APP` variable to `flaskr` directs flask to use the `flaskr` directory and the `__init__.py` file to find the application. \n\n## Tasks\n\nOne note before you delve into your tasks: for each endpoint you are expected to define the endpoint and response data. The frontend will be a plentiful resource because it is set up to expect certain endpoints and response data formats already. You should feel free to specify endpoints in your own way; if you do so, make sure to update the frontend or you will get some unexpected behavior. \n\n1. Use Flask-CORS to enable cross-domain requests and set response headers. \n2. Create an endpoint to handle GET requests for questions, including pagination (every 10 questions). This endpoint should return a list of questions, number of total questions, current category, categories. \n3. Create an endpoint to handle GET requests for all available categories. \n4. Create an endpoint to DELETE question using a question ID. \n5. Create an endpoint to POST a new question, which will require the question and answer text, category, and difficulty score. \n6. Create a POST endpoint to get questions based on category. \n7. Create a POST endpoint to get questions based on a search term. It should return any questions for whom the search term is a substring of the question. \n8. Create a POST endpoint to get questions to play the quiz. This endpoint should take category and previous question parameters and return a random questions within the given category, if provided, and that is not one of the previous questions. \n9. Create error handlers for all expected errors including 400, 404, 422 and 500. \n\nREVIEW_COMMENT\n```\nThis README is missing documentation of your endpoints. Below is an example for your endpoint to get all categories. Please use it as a reference for creating your documentation and resubmit your code. \n\nEndpoints\nGET '/categories'\nGET ...\nPOST ...\nDELETE ...\n\nGET '/categories'\n- Fetches a dictionary of categories in which the keys are the ids and the value is the corresponding string of the category\n- Request Arguments: None\n- Returns: An object with a single key, categories, that contains a object of id: category_string key:value pairs. \n{'1' : \"Science\",\n'2' : \"Art\",\n'3' : \"Geography\",\n'4' : \"History\",\n'5' : \"Entertainment\",\n'6' : \"Sports\"}\n\n```\n\n\n## Testing\nTo run the tests, run\n```\ndropdb trivia_test\ncreatedb trivia_test\npsql trivia_test \u003c trivia.psql\npython test_flaskr.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebugwithshubham%2F02_trivia_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdebugwithshubham%2F02_trivia_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdebugwithshubham%2F02_trivia_api/lists"}