How to use the sails.load function in sails

To help you get started, we’ve selected a few sails examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wejs / generator-wejs / blog / templates / bin / resetDB.js View on Github external
console.log('-');
  console.log('--');
  console.log('--- Database drop!!! DANGER!!! ----');
  console.log('--');
  console.log('-');

  var confirm = process.argv[2];
  if (!confirm) {
    // alows user set new user data
    confirm = sget('Are you sure you want to reset the database??. \n y or n?');
    confirm = confirm.replace('\n','');
  }

  if (confirm === 'y') {
    Sails.load({
      port: 1930,
      hooks: {
        grunt: false,
        socket: false,
        pubsub: false
      },
      models: {
        migrate: 'drop'
      },
      orm: {
        _hookTimeout: 50000
      },
      environment: 'development'
    },function loadSailsToDropDB(err, sails) {
    if (err) {
      return doneAll(err);
github wejs / generator-wejs / blog / templates / bin / loadSails.js View on Github external
module.exports = function loadSails(cb){
  Sails.load({
    port: 1930,
    hooks: {
      grunt: false,
      socket: false,
      pubsub: false
    },
    orm: {
      _hookTimeout: 40000
    }
  },function(err, sails) {
  if (err) {
    return cb(err);
  }
    // here you can load fixtures, etc.
    cb(err, sails);
  });
github balderdashy / sails / test / _benchmark / index.js View on Github external
benchmark('first time, no hooks', function(cb) {
			var sails = require('sails');
			sails.load({
				log: { level: 'error' },
				globals: false,
				loadHooks: []
			}, cb);
		});
github balderdashy / sails / test / integration / benchmark / index.js View on Github external
benchmark('with moduleloader hook', function(cb) {
			this.expected = 25;
			this.comment = 'should be faster b/c of require cache';

			var sails = require('sails');
			sails.load({
				log: { level: 'error' },
				globals: false,
				loadHooks: ['moduleloader']
			}, cb);
		});
github pantsel / konga / bin / konga.js View on Github external
require("../makedb")(function(err) {
    if(err) return process.exit(1);

    Sails.load({
      environment: 'development',
      port: process.env.PORT,
      hooks: {
        grunt: false
      }
    }, function callback(error, sails) {

      if(error) {
        Sails.log.error("Failed to prepare database:",error)
        return process.exit(1);
      }

      sails.log("Database migrations completed!")
      process.exit()

    });