2.0.0 • Published 6 years ago

sails-fixtures v2.0.0

Weekly downloads
29
License
MIT
Repository
github
Last release
6 years ago

Fixtures for sails

JSON fixtures. Data are automatically loaded and checked every time you lift your sails (if you use bootstrap from examples). Suggestions and pull requests are welcome.

Howto

  1. Setup your models
  2. Edit your bootstrap.js
  3. Fill data
  4. sails lift

Bootstrap config

Simply call #init(config, callback), it will handle the rest.

var fixtures = require('sails-fixtures');

module.exports.bootstrap = function(next)
{
  fixtures.init({
    'dir':'/path/to/your/fixtures/directory',
    'pattern':'*.json' // Default is '*.json'
  }, next);
};

Data format

Fixtures are loaded in parallel. Their contents are loaded in series in specified order.

[
  {
    "model":"modelname",
    "items":[
      {
        "id":1,
        "attribute":"foo"
      },
      {
        "id":50,
        "attribute":"bar"
      }
    ]
  },
  {
    "model":"anothermodel",
    "items":[
      {
        "id":7,
        "name":"test"
      }
    ]
  }
]
2.0.0

6 years ago

1.0.8

9 years ago

1.0.7

9 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago