##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
- dbUrl : http://hostname[:port]
- dbName : name of DB created above
- port : Port to host node app on
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..