npm install
forever start server.js
to stop server: forever stop server.js
default port is 8080
npm install
npm start
#server routes:
{}
{
"minVersionRequired": "x.x"
}
#Hittup routes:
an error message of 404 for /JoinHittup
, /UnjoinHittup
, /RemoveHittup
means the hittup doesn't exist.
timeInterval's first element is time before hittup starts, second element is time after hittup ends.
{
"timeInterval": [<seconds>,<seconds>],
"maxDistance": <Number> , //in meters
"coordinates": [<long>, <lat>],
}
{"success":true, "hittups":[
{
"_id": "<uid>",
"title": "<title>",
"isPrivate": <boolean>,
"duration": <seconds>,
"dateCreated": <seconds>,
"images": [ {
"lowQualityImageurl": "<full url>",
"highQualityImageurl": "<full url>"
},...],
"usersJoined": [
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"usersInvited": [ {
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"loc": {
"state": "<state>",
"city": "<city>",
"type": "Point",
"coordinates": [<long>, <lat>],
"lastUpdatedTime": <Int>
}
}
, ...
]
}
{
"hittupuid": "<uid>",
"useruid": "<uid>",
"userName": "<string>"
}
{"success":true}
or
{"success":false, "error":"<error message>"}
{
"hittupuid": "<uid>",
"owneruid": "<uid>",
"ownerName": "<string>"
}
{"success":true}
or
{"success":false, "error":"<error message>"}
the first image is the image posted by the host
{
"uid": "<uid>"
}
{"success":true, "hittup": {
"_id": "<uid>",
"owner": {
"firstName": "<firstname>",
"lastName: "<lastName>",
"fbid": "<fbid>"
},
"title": "<title>",
"isPrivate": <boolean>,
"duration": <seconds>,
"dateCreated": <seconds>,
"images": [ {
"lowQualityImageurl": "<full url>",
"highQualityImageurl": "<full url>"
},...],
"usersJoined": [ {
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"usersInvited": [ {
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"loc": {
"state": "<state>",
"city": "<city>",
"type": "Point",
"coordinates": [<long>, <lat>],
"lastUpdatedTime": <Int>
}
}
}
the first image is the image posted by the host
{
}
{"success":true, "hittup": {
"_id": "<uid>",
"owner": {
"name": "<name>",
"imageurl": "<url>"
},
"title": "<title>",
"isPrivate": <boolean>,
"duration": <seconds>,
"dateStarts": <seconds>,
"description": "<description >",
"dateCreated": <seconds>,
"images": [ {
"lowQualityImageurl": "<full url>",
"highQualityImageurl": "<full url>"
},...],
"usersJoined": [ {
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"usersInvited": [ {
"_id": "<uid>",
"fbid": "<fbid>",
"firstName": "<firstName>",
"lastName": "<lastName>",
},
...
],
"loc": {
"state": "<state>",
"city": "<city>",
"type": "Point",
"coordinates": [<long>, <lat>],
"lastUpdatedTime": <Int>
}
}
}
timeInterval's first element is time before hittup starts, second element is time after hittup ends.
{
"timeInterval": [<seconds>,<seconds>],
"maxDistance": <Number> , //in meters
"coordinates": [<long>, <lat>],
}
[ FriendHittups ] //just like the one in GetHittup
timeInterval's first element is time before hittup starts, second element is time after hittup ends.
{
"timeInterval": [<seconds>,<seconds>],
"maxDistance": <Number> , //in meters
"coordinates": [<long>, <lat>],
}
[ EventHittups ] //just like the one in GetHittup
{
"hittupuid": "<uid>",
"useruid": "<uid>",
"userName": "<string>"
}
{"success":true}
or
{"success":false, "error":"<error message>"}
POST format:
{"success":false, "error":"<error message>"}
{
"uid": "<uid>"
}
{
"owner": {
firstName: "<firstName>",
lastName: "<lastName>"
},
"title": "<title>",
"isPrivate": <boolean>,
"duration": "<duration>",
"dateCreated": "<dateCreated>",
"usersJoined": [
{
"_id": "<uid>",
"fbid": "<fbid>",
firstName: "<firstName>",
lastName: "<lastName>"
}
],
"usersInvited": [
{
"_id": "<uid>",
"fbid": "<fbid>",
firstName: "<firstName>",
lastName: "<lastName>"
}
],
"loc": {
"state": "<state>",
"city": "<city>",
"type": "<Point>",
"coordinates":[<long>,<lat>],
"lastUpdatedTime": <int>
}
}
{
"coordinates": [longitude, latitude],
"duration": <seconds>,
"title": "<title>",
"image": "<base64encodedimage>"
"isPrivate": <boolean>,
"uid": "<useruid>",
"ownerName": "<string>",
"usersInviteduids": ["<uid>","<uid>",...],
"image": "<base64encodedstring>",
"emoji": <String>
}
format of the image doesn't matter
{"success":true, "uid": "<uid>"}
or
{"success":false, "error":"<error message>"}
{
"coordinates": [<long>, <lat>],
"duration": <seconds>,
"title": "<title>",
"description": "<title>",
"image": "<base64encodedimage>"
"isPrivate": <boolean>,
"uid": "<EventOrganizeruid>",
"dateStarts": <seconds>,
"image": "<base64encodedstring>",
"emoji": <String>
}
format of the image doesn't matter
{"success":true, "uid": "<uid>"}
or
{"success":false, "error":"<error message>"}
{
"hittupuid": "<uid>",
"owneruid": "<uid>",
"title": "<title>",
"coordinates": [<long>,<lan>],
"isPrivate": <boolean>,
"duration": <seconds>
}
{"success":true, "uid": "<uid>"}
or
{"success":false, "error":"<error message>"}
{
"inviteruid": "<uid>",
"hittupuid": "<uid>",
"inviterName": "<uid>",
"hittupTitle": "<string>",
"friendsuids": ["<uid>","<uid>"]
}
{"success":true}
or
{"success":false, "error":"<error message>"}
{
"coordinates": [<long>, <lat>],
"uid": "<uid>"
}
{"city":location.city,"success":true}
{
"uid": "<uid>"
}
{"fb_friends":
[
{
"firstName":"<firstname>",
"lastName": "<lastname>",
"_id": "<uid>",
"fbid": fbid,
"loc":{
"type":"Point",
"state":"<state>",
"city":"<city>",
"coordinates":[<long>,<lat>],
"lastUpdatedTime": <int>
}
},
...
]
}
deviceToken is optional
{
"name": "<fbid>",
"deviceToken": "<deviceToken>"
}
{
"uid": "<uid>",
"name": "<name>"
}
HOW TO PUSH NOTIFY
download the certificate from http://developer.apple.com/iphone/manage/overview/index.action
open it using keychain access, export it to apns-cert.p12, then expand it and export the key to apns-key.p12
to convert them to .pem:
openssl pkcs12 -clcerts -nokeys -out apns-cert.pem -in apns-cert.p12
openssl pkcs12 -nocerts -out apns-key.pem -in apns-key.p12
#<<<<<for that one make sure u set a password
now we need to remove the password:
openssl rsa -in apns-key.pem -out apns-key-noenc.pem
now mv apns-key-noenc.pem key.pem
and mv apns-dev-cert.pem cert.pem
and make sure you remove anything before and after ---BEGIN CERTIFICATE---
and ---END CERTIFICATE-----
run with: NODE_ENV=production node <scriptName>.js