zero-node
This module helps you deal with models used in blog or other CMS easily.
Usage
- Add dependency to your module package.json file like:
{
"name" : "YOUR_MODULE_NAME",
"zero" : {
"dependencies" : {
"node" : "^0.0.1"
}
}
}
- Declare
isNode
in module.exports like:
module.exports = {
models : [{
identity : "post",
isNode : true
}]
}
- Node module will generate brief for node content, you can specify its behavior through global configs:
{
"node" : {
auto : true, //auto generate brief for node model
field : 'content', //the key of node content to brief
toField : 'brief', //which field to save brief
limit : 300, //brief length
exclude : [], //model in this array do not need briefing
}
}
- Node will add an extra
count
route for every node model. For example you declared apost
node. So there will be a route ashttp://localhost/post/count
will returns the amount of post.