restful-mongo

0.4.3 • Public • Published

RESTful MongoDB

It allows you to setup an HTTP API server to access data stored on MongoDB, easily and quickly.

Install and setup an express server using restful-mongo

  • npm install -g express-generator
  • express mongo-express
  • cd mongo-express && npm install
  • npm install --save restful-mongo to install restful-mongo
  • add to app.js file, in the section where routes are configured, the following code
var RestfulMongo=require('restful-mongo');
new RestfulMongo({
    HOST:'localhost',   // host of mongodb server, OPTIONAL
    PORT:27017          // port of mongodb server, OPTIONAL  
}).configure(app);
  • npm start
  • access browser at http://localhost:3000/api/test/collectionName to read JSON documents of collection collectionName of database test1

Example of HTTP requests

You can do following requests:

GET /api/localhost:27017/test1/collections HTTP/1.1

Get list of collection names of test1 database


GET /api/localhost:27017/test1/books HTTP/1.1

Get all documents of collection books of test1 database


GET /api/localhost:27017/test1/books?rawQuery={author:{$in:['Manzoni']}} HTTP/1.1

Get all documents of collection books of test1 database whose author is Manzoni

Disclaimer

  • the code behind this module is very old, not so readable, and needs refactoring. Do not consider this code as code that I usually write.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.4.31latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.31
0.4.10
0.4.00
0.3.90
0.3.80
0.3.70
0.3.60
0.3.50
0.3.40
0.3.30
0.3.20
0.3.10
0.3.01
0.2.80
0.2.70
0.2.60
0.2.50
0.2.41
0.2.31
0.2.20
0.2.10
0.2.00
0.1.90
0.1.80
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10
0.0.00

Package Sidebar

Install

npm i restful-mongo

Weekly Downloads

4

Version

0.4.3

License

BSD

Last publish

Collaborators

  • wonderflow-user
  • bitliner