Backend for the stone system, using node.js, express.js, and mongoDB
Imitation is the greatest form of flattery
#api
When it's live, hit [redacted].alexkersten.com, port 3333, with the following:
Create an account with account/create, look up your UID with account/lookup and keep track of it locally, then you can invoke account/addfriend, account/delfriend, or even account/getfriends.
Message posting is primarily username based, so don't worry about UID for that. (Yet.)
Returns a list of local message IDs, within a radius (in feet) of the user, along with the message, message rating and position.
Returns a JSON like [{"_id": "16'hxx", "message": "blah", "rating": 5.0, "lat": 44.4, "lon": 22.2, "username": "alex"
, "recipient": "public", "private": false}, ...]
Posts a message. username must be an extant user created with account/create. Recipient is the name of the only person who can see the message - if public, this is a public message and everyone can see it.
Returns a JSON like {"success": true}
Upvotes or downvotes a message. amount should be a magnitude, dir should be -1 or 1
Returns a JSON like {"success": true}
Assigns a new uid to you - you should look up this UID with lookup/:displayName in order to keep track of this in your app and tag all of your API requests with it...
Returns a JSON like {"success": "true"}
Changes account properties - like updating a display name when a user changes it, so that other users can search by display name.
Returns a JSON like {"success": true}
Use this to get the UID of another person in order to follow them. Returns the UID of the account which goes by displayName - your app should keep track of this locally, in case the displayName changes - when showing message pins, maybe highlight the ones from followed UIDs in a different color?
Returns a JSON like [{"username":, "whatever", "_id": "8234eab83292"}]
Adds user who goes by displayName to uid's friends list.
Returns a JSON like {"success": true}
Removes user who goes by displayName from uid's friends list.
Returns a JSON like {"success": false}
Gets a list of friend display names and UIDs for uid.
Returns a JSON like [{followeeName: "Abc", followee: "572374bea"}, {followeeName: "Bcd", followee: "74744747bb"}]
- Run
node stoneapi/server.js
The mongodb database is running in auth mode with no users, so only localhost has access.
- node
- express
- mongodb (and node package
mongodb)