README
DragonNode.js RestAPI
Bundle with modules to develop RestAPI server application
- Add the body parser for json data
- Serves the package information for the application
- Services for validate input from the client
Installation
- Add bundle to the "package.json":
{
"dependencies": {
"dragonnodejs-restapi": "^1.0.0"
}
}
- Run "npm install"
- Extend the configuration in "app.js":
var config = {
modules: {
npm: [
[require('dragonnodejs-restapi'), {
bodyParser: {},
package: {
path: __dirname + '/package.json'
},
validators: function (validator) {
return {
email: function (input) {
input = validator.trim(input);
if (!validator.isEmail(input)) {
throw new Error('invalid email');
}
return input;
},
password: function (input) {
input = validator.trim(input);
return input;
}
};
}
}]
]
}
};