sails.js setup: How to make a node module available across the sails project (controller / model, etc)?

node-modules, sails.js

Solution

you can use the bootstrap.js (in config/)

like:

module.exports.bootstrap = function (cb) {
  sails.moment = require('moment');

cb();
};

in all Sails-Files you can use

sails.moment() 

now.

Problem

I just getting started with SailsJS as my first web framework on Node. Let's say I wanna add MomentJS in and use across the app. How to set it up?

Original source