Tag: sails.js

Using Sequelize with Redshift

Is it possible to use Sequelize with Redshift? If not, what are the alternatives? I need an ORM for Node.js with built-in support for transactions, hence Sails.js is not an option. I’ve also looked at Bookshelf, but could not find any support for Redshift either.

Multi-line commands in the sails console

Wrote multi-line command in the sails console but couldn’t execute them. Tried ending with semicolon ‘:’, pressing ctrl/alt/shift enter, but all they do is create new lines. How to execute multi-line commands in sails console? Just a simple example: User.find() .where({“name”:”John”}) .update({ “name” : “JohnGalt” }); Instead of all in the same line ..

npm install not installing things at /usr/bin

I am trying to install SailsJS with: $ sudo npm install -g sails It works, install everything at /home/brunoluiz/npm/lib/node_modules/sails with the following log: /home/brunoluiz/npm/bin/sails -> /home/brunoluiz/npm/lib/node_modules/sails/bin/sails.js sails@0.9.16 /home/brunoluiz/npm/lib/node_modules/sails ├── connect-flash@0.1.1 ├── pluralize@0.0.5 ├── inflection@1.2.5 ├── grunt-sails-linker@0.9.5 ├── grunt-contrib-clean@0.4.1 ├── node-uuid@1.4.0 ├── async@0.2.9 ├── grunt-contrib-concat@0.3.0 ├── grunt-contrib-copy@0.4.1 ├── grunt-contrib-coffee@0.7.0 ├── ejs-locals@1.0.2 ├── ejs@0.8.4 ├── underscore.string@2.3.0 ├── […]

JSON stringify in Node JS not serializing array of objects

I am using sails.js (node js framework). I am trying to JSON.stringify one of the objects, but when I do that it omits one of the fields (rooms array below). Here is what console.log(object) gives me: [ { rooms: [ [Object], [Object] ], state: ’53df76c278999310248072c6′, name: ‘Sydney Center’, menuItems: null, createdAt: Mon Aug 04 2014 […]

How to get the base or root url in sailsjs?

Is there a sails way of extracting the root or base url of an app? I basically need this for sending activation emails with links.

sails.js nested models

In sails.js 0.10 I’m trying to do the following // user.js module.exports = { attributes: { uuid: { type: ‘string’, primaryKey: true, required: true } , profile: { firstname: ‘string’, lastname: ‘string’, birthdate: ‘date’, required: true } } }; I’m getting an error when trying to create a user and sailsJS doesn’t recognize the “profile” […]

How can I access my models in sailsjs outside a controller?

I have a controller that looks like this. module.exports = { readbyslug: function (req, res) { var slug = req.param(‘id’); Store.findOneByName(slug.split(‘-‘).join(‘ ‘)) .then(function(err, store){ if(err) res.send({status:’error’, msg:’no store’}); res.send(store); }); } }; however, I would rather not have all this login in the controllers, I would rather stick them in another module. My question is, […]

Logout a user from all devices with express or sails.js

I am using sails.js, connect-redis and passport for my authentication flow. But i am not able to logout a user from all devices. I tried to find documentation at connect-redis and passport but there is not such option. Any information would be great.

can not install waterlock local auth

I am trying to use waterlock for authentication. i have installed waterlock but failing to install waterkick-local-auth. the error message is shown bellow: gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067:12) […]

Error while getting Google Drive permissions ID (Drive REST API, getIdForEmail)

I am building an application in SailsJS (v0.11) & Angular (v1.4.4) based on the Google API’s. I am using the Google Drive NodeJS library to retrieve the permission ID of a user. Unfortunately it does not work. I am using the following code to retrieve the permissions ID. sails.googleDrive.permissions.getIdForEmail({ email: user.email }, function(error, permissions) { […]

Node.js is the Best Javascript runtime in the world.