First, you have to install the library you want to add with npm install --save <libraryName>
.
Then, on top of your controller, before module.exports = ...
, require this library:
var libraryName = require('<libraryName>');
That's it.
In case of Underscore.js it will be:
npm install --save underscore
then
var _ = require('underscore');
on top of your controller. After that you'll be able to use _.
-functions anywhere in this file.
UPDATE
The answer by InternalFX makes perfect sense too. Sails.js indeed globalizes Lodash via _
, and pretty much all the functionality of Underscore Lodash implements too, so in this case, that's right, you don't even have to do anything.