Skip to content

Instantly share code, notes, and snippets.

@verma
Created January 24, 2013 20:38
Show Gist options
  • Save verma/4627465 to your computer and use it in GitHub Desktop.
Save verma/4627465 to your computer and use it in GitHub Desktop.
Cruder usage
var
cruder = require("../lib/cruder"),
db = require("../lib/db").MySQLConnection;
var c = new cruder.Cruder(db.connection, "locations",
["*title", "*address", "lat", "lng", "*url", "list_url", "map_url", "live_url" ]);
var app = express(); // app is an express app
app.get('/api/locations', c.list(null, "locations"));
app.post('/api/locations', c.create());
app.get('/api/locations/:id', c.get());
app.put('/api/locations/:id', c.update());
app.delete('/api/locations/:id', c.delete());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment