Socket
Socket
Sign inDemoInstall

sails-fixtures

Package Overview
Dependencies
33
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sails-fixtures

Easy to use fixtures for sails


Version published
Weekly downloads
7
decreased by-30%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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"
      }
    ]
  }
]

FAQs

Last updated on 22 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc