bootsoles
v0.1.8
Published
General skeletons and default methods for BootsolesJS
Downloads
1
Readme
Bootsoles
Components to aid in quick deployment of mongoose REST applications
Components
BootsolesController(model)
: Provides default implementation for common CRUD methods in a rest application. Available default implentations are:
BootsolesController.create()
BootsolesController.read()
BootsolesController.update()
BootsolesController.destroy()
Example var MyModel = require('./model.js'); // This is any mongoose model var BootsolesController = require('bootsoles').BootsolesController;
var MyController = {
create: function(params, callback) {
// Fancy logic of your own
},
read: BootsolesController(MyModel).read(), // Default read implementation
update: BootsolesController(MyModel).update(), // Default update implementation
destroy: function(params, callback) {
// customs destroy code.
}
}
module.exports = MyController
BootsolesRoutes(controller)
: Provides default implementations for common REST calls. They allow for required extra params as well.
BootsolesRoutes.create(requiredParams)
BootsolesRoutes.read(requiredParams)
BootsolesRoutes.update(requiredParams)
BootsolesRoutes.destroy(requiredParams)
Example var MyController = require('./my_controller.js'); var BootsolesRoutes = require('bootsoles').BootsolesRoutes;
.
.
.
app.post('/myobject', BootsolesRoutes(MyController).create())
app.get('/myobject/:_id', BootsolesRoutes(MyController).read(
{
_id: 'required'
},
{
'params._id': 'myObjectId'
}
));