سؤال

It's annoying to have to restart the sails server when you change something, is there any way to make sailsjs do what meteor does where when you save a serverside file it automatically updates the clientside?

That's a pretty awesome feature, and I love sails but that feature is pretty cool.

هل كانت مفيدة؟

المحلول

Nodemon is a helpful development tool that watches the files in the directory that it was started in, and if anything changes are detected, your node.js application will automatically restart.

To install nodemon (you may need to use sudo)

$ npm install -g nodemon

Sails.js continually writes to the .tmp folder, and as a result you will find that nodemon will continually restart the server. To resolve this issue, simply ignore this folder by creating a .nodemonignore file with this single line, noting you can place any other files/folders you wish to ignore on separate lines

.tmp/*

To run your Sails.js application through nodemon

$ nodemon app

For more information, be sure to check out nodemon on npmjs.org

نصائح أخرى

If you monitor nodemon --ignore 'tmp/*' --ext js,ejs . you will still get the infinite reload problem. Apparently Sails is constantly writing the ejs files.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top