Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

apigee-127/volos-waterline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

volos-waterline is a Volos connector for using Waterline.

Project Badges

  • Dependencies: Dependencies
  • Developer dependencies: Dev Dependencies
  • Downloads: NPM Downloads Per Month
  • License: License
  • NPM Version: NPM Version

Installation

volos-waterline is distributed via NPM so installation is the usual: npm install volos-waterline --save.

Usage

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
});

Contributing

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.

About

A Volos connector for Waterline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published