# PDX Movie list

## Setup

[Node][node] >= 7.10 is required.

Yarn is recommended for package management.

`npm install -g yarn`

Install all dependencies

`yarn install` or `npm install` if not using yarn

[Firebase][firebase] is used for some simple data storage.  Since Firebase is initialized in the `server.js` file, you will need a Firebase account and a project set up.  Firebase is owned by Google so a Google account will do.  The basic Firebase plans are free.

When you create a firebase project, add a user to the project.  Then get all of the relevant project details and add them to a `.env` file.  The file `.sample.env` has an example of the required fields. Replace the values with your Firebase project values and save as `.env`.

## Running

To run the application, just run `npm start`.  It will start up the server and serve on port 5000.

To access the application locally, navigate to `http://localhost:5000`.

## Mobile testing

If you want to access on mobile, determine the IP address of your computer.

Linux: `ifconfig`

Windows: `ipconfig`

Then, on your mobile device, navigate to `http://<YOUR IP>:5000`, e.g. `` and you should see the page load up.  This will only work if you have the local server running on the computer and your mobile device is connected to the same network.

## Building assets

If you modify the files in the `/src` directory, you will have to re-build the files with webpack.  There are two commands you can use:

`npm run build-dev`

This will build the assets, but it will not minify the JS.  Slightly easier for debugging.

Also, `build-dev` will hide the movie poster images, which saves some bandwidth and time if you're constantly refreshing the page.

`npm run build-assets`

This will build a "production" version of the files.  The JS will be minified and the movie posters will be displayed.

## Windows

Note that some of the npm scripts use "NODE_ENV" to set the process.env variables.  This won't work on Windows.  You'll have to modify the `package.json` file so that the following scripts read as follows:

"build-dev": "set NODE_ENV=development&& webpack",
"build-assets": "set NODE_ENV=production&& webpack",