Git Product home page Git Product logo

dropp's Introduction

Build Status

Dropp

A location-based social media app where posts live for 24 hours. Explore your community and venture to new places to discover dropps around you. Available for iOS and Android platforms.

Prerequisites

Firebase account key

  1. Go to the Firebase console
  2. Click GENERATE NEW PRIVATE KEY at the bottom
  3. Name the file serviceAccountKey.json and place it to the same directory as server.js

Google Cloud Storage account key

  1. Go to the Google Cloud Storage console
  2. Click Create credentials at the top and then choose Service account key from the dropdown menu
  3. Select storage-adminsdk from the dropdown menu and JSON as the Key type
  4. Name the file storageAccountKey.json and place it to the same directory as server.js

Note: Never put service account keys on Github

Install node modules

  • npm install --save @google-cloud/storage
  • npm install
  • Quick fix: PATH="/c/Program Files/nodejs/:$PATH"

Run the server

  • sudo npm start

Test the API routes

  • sudo npm test

dropp's People

Contributors

alandao avatar pcherng01 avatar requinn avatar richcherng avatar stevenmccracken avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

pcherng01

dropp's Issues

API: Implement followers and following features

Creating a new user should also initialize two lists: Followers and Following. These will both be initially populated with key,value = 0,Dropp. The following API endpoints should be made:

  • Request to follow a user
  • Accept a follow request
  • Remove a follower
  • Get all followers
  • Get all following
  • Remove a following

Token on Database

For server, on start up, load token from firebase.

Store new token to firebase

Fatal server error after retrieving dropps posted by a user

Discovered severe error in Pull Request #13. All requests work as intended and catch errors correctly. The error is "primed" when the server receives a GET request at /users/:username/dropps. The error does not occur until the server receives a POST request at /dropps to create a dropp. This request after the GET request causes some confusing logic with the callbacks and tries to send the response to the client twice.

Here is the error call stack:

2017-04-27T08:45:35.695Z: POST request received from IP ::1
FIREBASE WARNING: Exception was thrown by user callback. Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
    at ServerResponse.header (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:725:10)
    at ServerResponse.send (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:170:12)
    at ServerResponse.json (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:256:15)
    at firebase.getDroppsByUser.dbResult (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/modules/router_mod.js:238:20)
    at droppsRef.on.droppsSnapshot (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/modules/firebase_mod.js:280:12)
    at /Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:126:791
    at Ac (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:63:165)
    at jf (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:126:215)
    at kf (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:125:539) 
/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:63
(d="0"+d),c+=d;return c.toLowerCase()}var zc=/^-?\d{1,10}$/;function tc(a){return zc.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Ac(a){try{a()}catch(b){setTimeout(function(){N("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function Bc(a,b,c){Object.defineProperty(a,b,{get:c})}function Cc(a,b){var c=setTimeout(a,b);"object"===typeof c&&c.unref&&c.unref();return c};function Dc(a){var b={},c={},d={},e="";try{var f=a.split("."),b=bb(hc(f[0])||""),c=bb(hc(f[1])||""),e=f[2],d=c.d||{};delete c.d}catch(g){}return{yg:b,He:c,data:d,og:e}}function Ec(a){a=Dc(a);var b=a.He;return!!a.og&&!!b&&"object"===typeof b&&b.hasOwnProperty("iat")}function Fc(a){a=Dc(a).He;return"object"===typeof a&&!0===y(a,"admin")};function Gc(a,b,c){this.type=Hc;this.source=a;this.path=b;this.children=c}Gc.prototype.Jc=function(a){if(this.path.e())return a=this.children.subtree(new J

Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
    at ServerResponse.header (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:725:10)
    at ServerResponse.send (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:170:12)
    at ServerResponse.json (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/express/lib/response.js:256:15)
    at firebase.getDroppsByUser.dbResult (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/modules/router_mod.js:238:20)
    at droppsRef.on.droppsSnapshot (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/modules/firebase_mod.js:280:12)
    at /Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:126:791
    at Ac (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:63:165)
    at jf (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:126:215)
    at kf (/Users/stevenmccracken/GitHub/School/Dropp/Dropp/node_modules/firebase-admin/lib/database/database.js:125:539)

npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Dropp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Dropp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Dropp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/stevenmccracken/GitHub/School/Dropp/Dropp/npm-debug.log

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.