entropy is a simple RESTful server in front of a MongoDB instance using node.js, Express, Connect and Mongoose.
Clone the Github repository or simply download the sources. You can run an
entropy instance just by starting it with the node
command:
node entropy.js
Copy the config.json.sample
file to config.json
and modify it to fit your
needs.
You can put your Mongoose models in the /models
directory. Here's an example
of an simple user model:
// models/user.js
var mongoose = require("mongoose").Mongoose;
mongoose.model("user", {
properties: ["username", "email"],
cast: {
username: String,
email: String
},
indexes: ["username", "email"]
});
That's it. You can now find, read, create, modify and remove user objects via REST, just by calling the appropriate URLs:
GET localhost:3000/user // find
GET localhost:3000/user/1 // read
POST localhost:3000/user?user[username]=foo&user[email]=bar // create
POST localhost:3000/user/1?user[username]=foo&user[email]=bar // modify
DELETE localhost:3000/user/1 // remove
For the full copyright and license information, please view the LICENSE
file
that was distributed with this source code.