1.2.2 • Published 11 years ago

cruder v1.2.2

Weekly downloads
30
License
-
Repository
github
Last release
11 years ago

CRUD for express and mongoose

Usage

mongoose = require "mongoose"
express = require "express"
cruder = require "cruder"

db = mongoose.createConnection "mongodb://localhost/test"

UserSchema = new mongoose.Schema
  username: type: String, required: true
  password: type: String, required: true

User = db.model "users", UserSchema

app = express()
app.use express.bodyParser()

# Generate all CRUD actions for model User. That equals:
#   app.get "/users", cruder.list User.find().sort(username: 1)
#   app.post "/users", cruder.post User
#   app.get "/users/:id", cruder.get User
#   app.put "/users/:id", cruder.put User
#   app.delete "/users/:id", cruder.delete User
cruder app, User, query: User.find().sort(username: 1)

app.listen 3000 if require.main is module
1.2.2

11 years ago

1.2.1

11 years ago

1.2.0

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.1

12 years ago

0.1.0

12 years ago