Keep user logged when restarting a sails.js application

I'm working on a sails app still under development.Each time I make a modification in a controller, I need to restart sails with a 'sails lift' command. Hopefully, it can be eased by using 'forever' tool which detect modifications and restart automatically.But I need to re-log into my application (because the session is lost when restarting ?) which is really not convenient. Is there any way to keep the user logged when restarting ?...Read more

sails.js - Sails crashes on file upload aborted with skipper

I'm using skipper with skipper-s3 adapter to handle file uploads in my sails application. It works fine when the file is sent normally, yet when the request is aborted I got an unhandled error message and sails throw er; // Unhandled 'error' event ^Error: Request abortedat IncomingMessage.onReqAborted (/Users/olivierroche/Dev/loopIt/API/node_modules/skipper/node_modules/multiparty/index.js:175:17)at IncomingMessage.emit (events.js:104:17)at abortIncoming (_http_server.js:279:11)at Socket.socketOnEnd (_http_server.js...Read more

Sails.js File upload with Skipper to AWS S3

I have a form where you can upload a file. I upload the file directly with skipper and it works perfectly.req.file('file').upload({ adapter: require('skipper-s3'), key: 'key', secret: 'secret', bucket: 'bucketname'}, function (err, uploadedFiles) { if (err){ // ko } else{ // ok }});But I want to resize first and then upload the file, so:sharp(original).resize(800).quality(90).toBuffer(function(err, outputBuffer) { if (err) { // ko } // ok outputBuffer; });So, my question is: How can uploa...Read more

Logic of beforeValidate() in sails.js

I am new to sails.js, and after some works I find beforeValidate() hard to use.I have a model User with just 2 attributes nickname and age. Both attributes are marked as required so sails will check the validation. When creating an user, if the client does not specify its nickname, I would like to assign a random nickname to it, as following:beforeValidate: function(user, next){ if (!user.nickname) user.nickname = randomString(5); next();}This assigning should be applied before sails validates the required tag of nickname, so the beforeVa...Read more

Changing config params without server reload in sails.js

Is it possible for Sails.js app to understand config file changes without having to restart server ? I want to add routes and change Mail server config params without server reboot. sails-hook-autoreload, seems to only cover models, controllers and services.What are my options? I really do not want to restart the server when there are so many users logged into the app.Please help. Thanks for reading the post...Read more

sails.js - running background job on a specific action in sails js

i am trying to make a service that runs in background when specific event happens. As an example when user verifies email i want my service of deleting possible unverified duplicate emails form database. i tried using kue to save my purpose but i think its more like the services will run once the sails lift fires? so how to run a service when specific event happens? any help would be much appreciated.thanks...Read more

sails.js - Bluebird Promise each in mocha/chai test not working

I would like some help to determine why my unit test in a sails.js app is not working as expected.I am using mocha, chai and bluebird promise library on a sails.js app.What I want to achieve:Create a test for TagsService.create(name) method, which accepts a nameparameter.Test that this method will not create a new tag record based on invalid names I passThe name parameter is required and should be less than 121 characters longWhat I currently have:// Test the 'create' methoddescribe('Method \'create\' test result: \n', function () { // Test ...Read more

sails.js - Using pubsub works with shortcuts, but not with RESTful record creation

I'm having an issue where I'm getting events from the sails resourceful pubsub when I create a record with the shortcut routes, but not with the RESTful routes.In my client code, I have a sails socket that I listen to for the model: io.socket.on('users', function(event){console.log(event);})If I use a shortcut route to create a record (http://localhost:1337/users/create?name=test), I get the callback in the console as expected:>{verb: "created", data: {…}, id: 44}However, if I use the socket to post from the client, the callback never fires....Read more

passport.js - Sails.js: error logging in with passport

When this part of my code gets executed:req.login(user, function (err){ if (err) return res.negotiate(err); return res.redirect('/welcome');});I get the following error:/home/oriol/Desktop/containers/node_modules/sails-mongo/node_modules/mongodb/lib/utils.js:98 process.nextTick(function() { throw err; }); ^Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn (/home/oriol/Desktop/containers/node_modules/passport-local/node_modules/passport/lib/passport/http/request...Read more

sails.js - Sailsjs grunt .svn error during lifting

I have imported my project in svn when I did a checkout and ran the app I got this error I am using sailsjs-0.10.5. I think it is to do with the grunt I am not able to find any solution it works fine in mac not in linux I set the permissin to 0777 even though it is not working here is the error.verbose: Grunt :: Loading "Gruntfile.js" tasks...verbose: Grunt :: ERRORverbose: Grunt :: >> TypeError: Property '.svn' of object # is not a functionverbose: Grunt :: Warning: Task "default" not found. error: ** Grunt :: An error occurred. **error:Aborte...Read more