Giter Club home page Giter Club logo

trivo's Introduction

Trivo, a Flask trivia game API

Table of Contents

Summary

Trivo is a trivia game API that I built to practice full stack programming as part of my Full Stack Nanodegree from Udacity.

It uses flask as a web framework, PostgreSQL as the database of choice and SqlAlchemy as the ORM

It demonstrates my understanding of API creation, error handling,full documentation and unit testing.

Technologies

Flask was used as a backend using python. PostgreSql as the database I used. SQLAlchemy as the ORM of choice.

Features

  1. Get a list of categories.

  2. Get a list of questions in a given category.

  3. Search questions.

  4. Post question.

  5. Delete question.

  6. Start playing the game.

Endpoints

{
  "briefing": "Welcome to the trivia API, below is the list of the available endpoints, for more information check our documentation file", 
  "endPoints": {
    "/api/categories": {
      "function": "get_categories", 
      "methods": [
        "GET"
      ]
    }, 
    "/api/categories/<int:category_id>/questions": {
      "function": "get_question", 
      "methods": [
        "GET"
      ]
    }, 
    "/api/questions": {
      "function": "post_question", 
      "methods": [
        "POST"
      ]
    }, 
    "/api/questions/<int:question_id>": {
      "function": "delete_question", 
      "methods": [
        "DELETE"
      ]
    }, 
    "/api/questions/search": {
      "function": "search_questions", 
      "methods": [
        "POST"
      ]
    }, 
    "/api/quizzes": {
      "function": "start_quizz", 
      "methods": [
        "POST"
      ]
    }
  }, 
  "success": true
}

Documentation

For a detailed documentation Full documentation.

Unit Testing

A test_flask.py file is included that includes a comprehensive list of unit tests. The PostgreSQL connection string needs to be supplied below

self.database_path = "postgres://{}/{}".format('postgres:root@localhost:5432', self.database_name)

Initialization

a psql file is provided trivia.psql we a list of initial questions which can be imported to your PostgreSQL instance

Usage and installation

You can get the project up and running in 3 simple steps.

  1. Use the following command to install the required packages
pip install -r requirements.txt
  1. Edit the models.py file and add your PostgreSQL connection string
database_path = "postgres://{}/{}".format('CONNECTION_STRING', database_name)
  1. Use The following command to start the server and voila!
set FLASK_APP=flaskr
set FLASK_ENV=development
flask run

trivo's People

Contributors

hossamabubakr avatar

Watchers

 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.