GithubHelp home page GithubHelp logo

tsoporan / movie_catalogue Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 146 KB

A simple app to track movie collections

License: GNU General Public License v3.0

Python 50.19% HTML 6.42% JavaScript 43.39%
react reactjs flask rest-api rest python3 javascript

movie_catalogue's Introduction

MovieCatalogrrr

NOTE: This is a quick and dirty example project using a RESTful API and React!

A simple app to track movie collections.

Image of MovieCatalogrrr


Set up

The application is broken up in two pieces, the server-side api written using Flask and a client-side SPA written using React.

API

Requirements
  1. Install
cd api && pipenv install
  1. Activate env
pipenv shell
  1. Load up the DB
python db.py

# Optionally load up some seed data
sqlite3 movies.db < seed.sql
  1. Run
export FLASK_ENV=development # Optional
FLASK_APP=api:create_app flask run
Examples

The API can currently only return a JSON response, ex:

λ ~/projects/movie_catalogue/ master* curl localhost:5000/movies/1
{
  "actors": [
    {
      "id": 3,
      "name": "Jake Gyllenhaal"
    }
  ],
  "created_at": 1533516337,
  "genres": [
    {
      "id": 4,
      "name": "thriller"
    },
    {
      "id": 5,
      "name": "sci-fi"
    }
  ],
  "id": 1,
  "rating": null,
  "seen": 0,
  "title": "Donnie Darko"
}

Some examples of querying with cURL:

# See all movies
curl "localhost:5000/movies"

# Apply some filters
curl "localhost:5000/movies?title=John"
curl "localhost:5000/movies?limit=2"
curl "localhost:5000/movies?genre=action"
curl "localhost:5000/movies?genre=action&limit=1"

curl localhost:5000/genres
curl localhost:5000/actors

# Adding a movie
curl -X POST -d "title=Sharknado" http://localhost:5000/movies # Try again and notice error response
curl -X POST -d "title=John%20Wick%202&genres=action&actors=Keanu%20Reeves" http://localhost:5000/movies # With genre and actor
curl -X POST -d "title=Speed&genres=action,crime&actors=Keanu%20Reeves,Sandra%20Bullock" http://localhost:5000/movies # Multiple

# Use movie ID to query
curl http://localhost:5000/movies/1 # Your ID

# You can also POST to create genres and actors

SPA

Requirements
  1. Install
cd app
yarn install
  1. Run
yarn start

movie_catalogue's People

Contributors

tsoporan avatar

Watchers

 avatar

movie_catalogue's Issues

Search UI

A user should be able to search by movies based on title, genre, and actor. It would be also nice to be able to do AND and OR type queries.

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.