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.
- Setup your models
- Edit your bootstrap.js
- Fill data
sails lift
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);
};
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"
}
]
}
]