Giter VIP home page Giter VIP logo

lunch's Introduction

Lunch

An app for groups to decide on nearby lunch options. Check out a live version, or read the blog post about it!

Setup

/etc/hosts

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

Environment variables

Make two copies of .env.sample, named .env and .env.prod.

Google project

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.pink as 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:3000 and https://local.lunch.pink:3000 as authorized JavaScript origins
    • Enter http://local.lunch.pink:3000/login/google/callback and https://local.lunch.pink:3000/login/google/callback as authorized redirect URIs
  • 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, and https://*.lunch.pink as HTTP referrers.

Database

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.

Commands

After setting up your environment:

First, install Yarn. Then:

yarn
npx sequelize db:migrate

To seed your database with a Superuser, fill out the SUPERUSER_* env variables accordingly, then run

npx sequelize db:seed:all

Development server

Running

npm start

npm start will default to localhost, but the browser should point to https://local.lunch.pink:3000

Logging in

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.

Production server

Building

npm run build

Running

node build/server.js

Deploying

You can modify tools/deploy.js as needed to work with your deployment strategy.

Service Worker

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.

Testing

Unit tests

npm test

To run an individual file:

npm run test-file /path/to/file

Testing with coverage

npm run coverage

Integration tests

Make 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
[email protected]
USE_HTTPS=false

Then run:

npm run integration

Individual files can be run using:

npm run integration-file path/to/file

Or selected using the Cypress Test Runner in interactive mode:

npm run integration-interactive

Linting

npm run lint

More info

This 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.

lunch's People

Contributors

ademuk avatar bdj61383 avatar bsitruk avatar chentaixu avatar dependabot[bot] avatar frenzzy avatar goatslacker avatar granda avatar greenkeeperio-bot avatar jazmon avatar jeffreyatw avatar jorrit avatar josephfrazier avatar koistya avatar langpavel avatar matrus2 avatar nodkz avatar nyscherm avatar okendoken avatar phpeek avatar piglovesyou avatar richb-hanover avatar rsanchezpp avatar salttis avatar sdiaz avatar stupidism avatar svoynow avatar tobiasmuehl avatar zhiyelee avatar zwhitchcox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lunch's Issues

Update to React 15

Tried it once and broke a few things; delve deeper and see what's actually broken.

Implement Immutable.js

Change data structures to use Immutable.js to speed up object comparison / filtering / rendering, etc.

Search by tag

Maybe find a way to augment geosuggest, or add a second search field?

Hush Bing crawl errors

It appears that Bing crawls causes these errors:

Message: Cannot read property 'place_id' of null
Backtrace:
restaurants.js 20 .(...)
[PROJECT_ROOT]/webpack:/api/restaurants.js:20:in `.'
URL GET https://lunch.labzero.com:443/api/restaurants/97/place_url
Location No Environment specified on cd3c27cff9ea
Browser Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)

You can see the full error report at:
https://app.honeybadger.io/projects/49826/faults/31294673

Record where we decided to go

Create a "Decisions" table that records where we went. Allow only one decision to be recorded every 12 hours.

UI thoughts:

  • outlined checkmark next to restaurants that only appears if there is one vote or more present on the page
  • tooltip on checkmark: "We went here"
  • any logged-in user can click it
  • checkmark becomes filled. Yellow?
  • outlined, clickable checkmarks still remain on other restaurants
  • when an outlined checkmark is clicked, remove all other decisions from the past 12 hours

Does not affect votes. Can be used for sorting (most recent decisions at bottom).

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.