erunion / showtimes

[deprecated] a movie showtimes API
MIT License
52 stars 14 forks source link

Documentation of how to use those file #45

Closed KennyJack closed 8 years ago

KennyJack commented 8 years ago

Hi,

May i know how to use or implement movies.js, theaters.js file? There are no instruction on how to use it. it would be great if you can provide them @erunion

erunion commented 8 years ago

Unfortunately you can't use movies.js and theaters.js by themsevles. If you want to use the showtimes library, you have to use the whole library on a server.

Showtimes cannot currently be used within a web browser.

KennyJack commented 8 years ago

Hi Jon, I wish to use the showtimes library. How to use the whole library on a server?I just do not get it, how it work to using the movie.js and theather.js.Isnt you curl from google movie? Thanks

On Thursday, June 30, 2016 10:47 PM, Jon Ursenbach <notifications@github.com> wrote:

Unfortunately you can't use movies.js and theaters.js by themsevles. If you want to use the showtimes library, you have to use the whole library on a server.Showtimes cannot currently be used within a web browser.— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

erunion commented 8 years ago

Yes, the library makes a cURL request to Google Movies to scrape and aggregate data.

For setting it up on a server, it really depends on what you're application is doing. You could have an AJAX request that sends a call to something like /getMovies?location=11011. For your backend server (the handler for the /getMovies AJAX request), you'll have to have some sort of NodeJS server running to use this. Using a Node framework like Express might make your life easier getting up and running.

Once you have that all up and running, you can use NPM to install the library.

Then in your Express framework code, you can use the library within a request handler like:

var Showtimes = require('showtimes');
var api = new Showtimes(<`location` GET parameter>, {});

api.getTheaters(function (error, theaters) {
  if (error) {
    throw error
  }

  <return a response of `theaters`>
});