Skip to content
Get an HTTP API server in a matter of minutes.
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples/example1
lib
node_modules
test
.gitignore
.jshintrc
Gruntfile.js
README.md
coverage.html
index.js
package.json

README.md

RESTful MongoDB

Get an HTTP API server in a matter of minutes.

Requirements

  • node.js
  • npm
  • express

Usage

Example with express.js

var express=require('expresss');
var RestfulMongo=require('restful-mongo');

var app=express();

new RestfulMongo({
    HOST:'localhost',   // host of mongodb server, OPTIONAL
    PORT:27017          // port of mongodb server, OPTIONAL  
}).configure(app);

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.

Contributing

Test

Requirements

  • a MongoDB instance running on localhost and listening to port 27017

How to run test

npm test

Something went wrong with that request. Please try again.