An app for groups to decide on nearby lunch options. Check out a live version, or read the blog post about it!
Add this line to /etc/hosts:
127.0.0.1 local.lunch.pink
If you will be testing subdomains, you should add an additional line for each subdomain, e.g.:
127.0.0.1 labzero.local.lunch.pink
127.0.0.1 someotherteam.local.lunch.pink
If you want to run integration tests, you will also need to add:
127.0.0.1 integration-test.local.lunch.pink
Make two copies of .env.sample, named .env and .env.prod.
For GOOGLE_* env variables:
- Create a Google Developer app in the console.
- Enable the Google+ API, Contacts API, Maps JavaScript API, Places API, and Geocoding API.
- Click the OAuth Consent tab and add click "Edit app".
- Add
lunch.pinkas an authorized domain. - Click the Credentials tab and choose "OAuth client ID" from the Create Credentials dropdown.
- Choose "Web application" as the type.
- For local development:
- Enter
http://local.lunch.pink:3000andhttps://local.lunch.pink:3000as authorized JavaScript origins - Enter
http://local.lunch.pink:3000/login/google/callbackandhttps://local.lunch.pink:3000/login/google/callbackas authorized redirect URIs
- Enter
- Add your deployment target(s) as additional origins/redirect URIs.
- Go back to the Credentials tab and create two API keys - one for the client, and one for the server.
- On each API key, add
http://lunch.pink,https://lunch.pink,http://*.lunch.pink, andhttps://*.lunch.pinkas HTTP referrers.
For RECAPTCHA_* env variables, sign up for reCAPTCHA and generate a site and server key.
Set up a PostgreSQL database and enter the admin credentials into .env. If you want to use another database dialect, change it in database.js.
After setting up and starting the app, you will be able to log in with this user and create a team. If you did not supply a SUPERUSER_PASSWORD, you will need to log in via OAuth, using the email address you supplied for SUPERUSER_EMAIL.
After setting up your environment:
First, install Yarn. Then:
yarn
npx sequelize db:migrateTo seed your database with a Superuser, fill out the SUPERUSER_* env variables accordingly, then run
npx sequelize db:seed:allnpm startnpm start will default to localhost, but the browser should point to https://local.lunch.pink:3000
If you are logged into the production version of Lunch, you will need to log out in order to log in locally. This is due to the *.lunch.pink cookie conflicting with the *.local.lunch.pink cookie.
npm run buildnode build/server.jsYou can modify tools/deploy.js as needed to work with your deployment strategy.
To run the service worker locally, follow the above steps to run the production server. After testing the service worker, be sure to unregister the service worker in the browser (or close all local Lunch tabs) to avoid issues when testing on the development server.
npm testTo run an individual file:
npm run test-file /path/to/filenpm run coverageMake sure your .env file is filled out. Set up a separate test database using the same user as your development environment. Enter the following into .env.test:
DB_NAME=your_test_db_name
SUPERUSER_NAME=test
SUPERUSER_PASSWORD=test
SUPERUSER_EMAIL=test@lunch.pink
USE_HTTPS=falseThen run:
npm run integrationIndividual files can be run using:
npm run integration-file path/to/fileOr selected using the Cypress Test Runner in interactive mode:
npm run integration-interactivenpm run lintThis project was created using React Starter Kit. Many technology choices originate from its repository, but this project adds on Sequelize, RESTful APIs instead of GraphQL, and Redux.
