This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

mongofoo

0.3.1 • Public • Published

mongofoo

Resourceful JSON API for Express+Mongo

Install:

npm install mongofoo

Usage:

var express, mongofoo, http;

express = require('express');
mongofoo = require('mongofoo');

http = express();
http.listen(4567);

// Open database connection
mongofoo.connect('localhost/mydb');

// Mount on the application
mongofoo.mount(http);

// GET /tasks
// POST /tasks {}
// GET /tasks/:id
// PUT /tasks/:id {}
// DELETE /tasks/:id
mongofoo.resource('tasks');

Optionally you can provide a hash of custom actions for that resource:

mongofoo.resource('tasks', {

  'GET /done': function(request, response) {
    this.tasks.find({ done: true }).toArray(function(error, tasks) {
      response.json(tasks); 
    })
  }
});

Contribute:

This is a pet project I started to toy and learn Node, Mongo, realtime applications and stuff. But I don't see why it couldn't grow and become one serious motherf*cker module for production purposes. Off course it needs to mature until there. So if you like it, got comments or critics, feel free and tell me. You can open an issue, send an email or whatever.

Readme

Keywords

none

Package Sidebar

Install

npm i mongofoo

Weekly Downloads

0

Version

0.3.1

License

none

Last publish

Collaborators

  • haggen