Giter Site home page Giter Site logo

udacity_trivia_api_project's Introduction

Udacitrivia

This project enables you to do the following:

  1. Add a question with specific category and difficulty
  2. Display all questions in the Home page or List page
  3. Get questions per category if you clicked on any category at Home page
  4. Search for specific word in any question, all matched questions shall be displayed in search result regardlress of their category
  5. Delete a question using the 'bin' button under each displayed question
  6. Show question answer by clicking on 'Show Answer'
  7. Play the trivia game which is:
    • Choose one category to get questions from, or Choose 'All' to get questions from any category
    • A question shall be displayed and you have to guess the answer
    • Submit the answers
    • The quiz composed of 5 questions and after you submitted all the answers, a final score appears for you
    • After finishing the quiz 5 questions and got the score, you can play again!

Pre-requisites to run the project

  1. Python 3.7 should be installed at your machine
  2. Clone the project's repo
  3. Navigate to '/backend' and install all project's dependencies by running this command at your CMD:
  pip install -r requirements.txt
Key Dependencies
  • Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.

  • SQLAlchemy is the Python SQL toolkit and ORM we'll use handle the lightweight postgres database.

  • Flask-CORS is the extension we'll use to handle cross origin requests from our frontend server.

  1. In order to run the application, type these commands at your CMD:
  set FLASK_APP=flaskr
  set FLASK_ENV=development
  flask run

Where:

  • Setting the FLASK_ENV variable to development will detect file changes and restart the server automatically.
  • Setting the FLASK_APP variable to flaskr directs flask to use the flaskr directory and the __init__.py file to find the application.
  • Application runs on 'http://127.0.0.1:5000/' by default
  1. In order to run the website and visualize it, navigate to '/frontend' and type these commands at your CMD:
  npm install
  npm start

The website frontend runs on 'http://localhost:3000/' and it opens immediately as 'React App' at your browser

  1. Make sure to connect to the postgres database by configuring it in '/backend/models.py'

Tests

In order to run tests, navigate to '/backend' and run the following commands at the CMD:

  dropdb trivia_test
  createdb trivia_test
  psql trivia_test < trivia.psql
  python test_flaskr.py

Note: If this is your first time to run tests, you don't have to execute the 'dropdb' command

All tests are implemented in test_flask.py and should be maintained and updated if any changes occured in the backend endpoints handlers to make sure that the application is behaving correctly

API Reference

Please check the 'README' file included in '/backend' folder for reference

Authors

Software Engineer: Yousif Elhady

Acknowledgements

Thanks to all my mentors and colleagues at Udacity Web development nano-degree program

udacity_trivia_api_project's People

Contributors

yousifelhady avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.