Giter Site home page Giter Site logo

geo-adventure's Introduction

#GeoPhotoHunt

Build Status

Update: now available in the iOS App Store! GeoPhotoHunt

This is a RESTful API that accepts requests and generates responses in JSON data to create geo challenges and complete existing challenges. It utilizes Encrypted Authentication Tokens.

This API utilizes mongoDB for the database. To use the API, clone this repo and run:

npm install

###Example for creating a new user with superagent:

superagent localhost:3000/api/create_user post {
username: 'bills22',
email: '[email protected]',
password: '123456'
}

Response is an authentication token. Username, email, and password are required paramaters, and username and email must be unique.

###Example for signing in a user with superagent:

superagent localhost:3000/api/sign_in -u '[email protected]:123456'

Response is an authentication token. Note that only email and password are required to sign in, not username.

###Example for creating a new challenge with superagent:

superagent localhost:3000/api/challenges/newchallenge post {
challengeName:'cool challenge name',
creator: 'user',
image: 'imagestring',
loc: {
  latitude: 47.6097,
  longitude: 122.331,
  altitude: 83736,
  timestamp: 3736,
},
eat: (authentication token goes here)
}

Required parameters are:

challengeName: string
creator: string (username)
image: string
eat: token (string)

####Challenge will look like this in the database:

{ __v: 0,
  imageURL: 'https://exampleurl.com/img/challenge2.jpg',
  submissionsCount: 0,
  challengeId: '32c3e0d0-ff72-11e4-b03e-1dbef7cb539a',
  challengeName: 'cool challenge name',
  creator: 'user',
  _id: '555d5f8be4bc300095e8467b',
  submitters: [],
  rating: { allRatings: [] },
  loc:
   { timestamp: 3736,
     altitude: 83736,
     longitude: 122.331,
     latitude: 47.6097 }
}

###Example for fetching all challenges with superagent:

superagent localhost:3000/api/challenges get
{eat: authentication token goes here}

Response will be an array of all existing challenges.

###Example for fetching a specific challenge with superagent:

superagent localhost:3000/api/challenges/32c3e0d0-ff72-11e4-b03e-1dbef7cb539a get
{eat: authentication token goes here}

Response will be the requested challenge from the database. Note that the long string at the end of the URL is the challengeId.

###Example for submitting completed challenge with superagent:

superagent localhost:3000/api/challenges/submit/aeb71530-ff78-11e4-be6d-51b759bfdd0b patch {
newRating: 5,
submissionsMsg: 'hey yah',
username: 'user',
image: 'image string',
eat: (authentication token goes here)
}

All of the above are required parameters!

You'll get the image URL as a response:

{ imageURL: 'https://exampleurl.com/img/challenge2.jpg' }

####Challenge will look like this in the database after submissions:

{
  '_id' : ObjectId('555d6a6c9dcb17e4951277a5'),
  'imageURL' : 'https://exampleurl.com/img/challenge2.jpg',
  'submissionsCount' : 2,
  'challengeId' : 'aeb71530-ff78-11e4-be6d-51b759bfdd0b',
  'challengeName' : 'cool challenge name',
  'creator' : 'user',
  'submitters' : [
    'user',
    'user'
  ],
  'rating' : {
    'allRatings' : [
      '3',
      '5'
    ],
    'averageRating' : 4,
    'newRating' : 5
  },
  'loc' : {
    'timestamp' : 3736,
    'altitude' : 83736,
    'longitude' : 122.331,
    'latitude' : 47.6097
  },
  '__v' : 2,
  'submissionsMsg' : 'hey yah'
}

####User will look like this in the database:

{
  '_id' : ObjectId('555d5af0616b84809405a4da'),
  'username' : 'user',
  'completed' : [
    {
      'nameOfChallenge' : 'cool challenge name',
      'imageUrl' : 'https://exampleurl.com/img/challenge2.jpg'
    },
    {
      'nameOfChallenge' : 'cool challenge name',
      'imageUrl' : 'https://exampleurl.com/img/challenge2.jpg'
    }
  ],
  'basic' : {
    'password' : '$2a$08$9mf6OneLGZP3LCzp9HBSEOMtzQ4V2IdiaucF4co65YbIFQ8bo8ppm',
    'email' : '[email protected]'
  },
  '__v' : 2
}

###Contributors:

####JavaScript: Michael Bowen, Claudia Cuevas, Jay Springate, Satu Bailey

####iOS: Craig Chaillie

geo-adventure's People

Contributors

satuba avatar mikeebowen avatar clcuevas avatar jayspringate avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

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.