0

I'm using the NodeJS, Sails MVC framework and it seems super easy to get it up and running. Once I have it set up I just run the lift command it voila there's my hello world running all happy and good:

sudo sails lift

But when I make some code changes I'm supposed to restart the Sails app. I'm having trouble finding the command to stop and/or restart my Sails app. Please advise.

tonejac
  • 1,083
  • 3
  • 18
  • 32
  • 3
    Are you running it in a console? Have you tried stopping it with ctrl + c? –  Apr 09 '14 at 06:45
  • FYI, you shouldn't need `sudo` to lift sails, unless you created your project with `sudo sails new` (which you shouldn't do) or installed local dependencies with `sudo npm install` (which you also shouldn't do). The only thing you should need `sudo` for is installing Sails globally (`sudo npm install sails -g`). – sgress454 Apr 09 '14 at 14:32
  • Possible duplicate of [Auto reloading a Sails.js app on code changes?](https://stackoverflow.com/questions/18687818/auto-reloading-a-sails-js-app-on-code-changes) – Estreiten Sep 21 '18 at 15:29

1 Answers1

4

If you're lifting a Sails app in the console (as in your question) you can stop it by pressing Control + C, just like any other console app. To restart, call sails lift again.

If you happen to be running a Sails app programmatically (probably for testing), you can stop it by calling the lower method on the Sails object:

var sails = require('sails');
sails.lift(options, function(err, sails) {
   // Do some stuff with sails, then...
   sails.lower();
});
sgress454
  • 24,870
  • 4
  • 74
  • 92