volos-waterline is a Volos connector for using Waterline.
volos-waterline is distributed via NPM so installation is the usual: npm install volos-waterline --save
.
Right now volos-waterline is a very lightweight wrapper around Waterline so the only method available is
initialize(config, callback)
. Here is ane example usage:
var vw = require('volos-waterline');
var Waterline = require('waterline');
var config = {
adapters: {
localDisk: require('sails-disk')
},
collections: {
Users: Waterline.Collection.extend({
connection: 'localDisk',
identity: 'users',
attributes: {
email: {
type: 'email',
required: true,
maxLength: 128
},
firstName: {
columnName: 'first_name',
defaultsTo: 'Anonymous',
type: 'string',
maxLength: 64,
minLength: 2
},
lastName: {
columnName: 'last_name',
defaultsTo: 'User',
type: 'string',
maxLength: 64,
minLength: 2
},
username: {
type: 'string',
regex: /^[a-z0-9_-]{4,24}$/,
required: true,
unique: true
}
}
})
},
connections: {
localDisk: {
adapter: 'localDisk'
}
}
};
vw.initialize(config, function (err, details) {
if (err) throw err;
// Use your adapters, collections, connections and waterline
});
This project uses Gulp for building so npm install -g gulp
once you clone this project. Running gulp
in the
project root will lint check the source code and run the unit tests.