Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 1.85 KB

README.md

File metadata and controls

62 lines (40 loc) · 1.85 KB

#Cloudbase

##MongoDB BaaS built upon Node.js, Express, Mongo, and Socket.IO Allows one to quickly and easily add, query, remove and update items in a MongoDB
database using websockets or REST.

The code is fairly well documented with example curl usage per request and
an example client utilizing websockets is included in the clientExample directory.

###Installation:
Ensure that you have working MongoDB instance and that you have access to it.
Create a database to hold the created collections. Then:

INSTALL:

git clone https://github.com/TheInsomniac/CloudBase
npm install

EDIT: config.json.dist and rename to config.json

RUN:

npm start

###REST Usage:
Add Item:

curl -X POST -H "Content-Type: application/json" -d '{"_id":"test", "username":"me","password":"pass"}' \
http://localhost:3000/example

Get Item:

curl -X GET -H "Content-Type: application/json"  http://localhost:3000/example/test

Find Item ($regex, $lt, $gt, etc):

curl -X GET -H "Content-Type: application/json"  -d '{ "_id": { "$regex": "tes", "$options": "i" }}' \
http://localhost:3000/example

Update Item:

curl -X PUT -H "Content-Type: application/json" -d '{"username":"em","password":"ssap"}' \
http://localhost:3000/example/test

Delete Item:

curl -X DELETE -H "Content-Type: application/json" http://localhost:3000/example/test

Delete Collection:

curl -X DELETE -H "Content-Type: application/json" -d '{"clearcollection":"true"}' \
http://localhost:3000/example

Get Collection:

curl -X GET -H "Content-Type: application/json"  http://localhost:3000/example

####TODO:

  • MUCH better (rather..ADD SOME) error handling for improperly formated JSON queries..