admin管理员组

文章数量:1287612

I want to watch everything inside the "api" directory and all its subdirectories (recursively). How can I do that?

sudo supervisor -w app.js,api app.js

This doesn't seem to work. It only watches the "api" directory, not its subdirectories.

https://github./isaacs/node-supervisor

I want to watch everything inside the "api" directory and all its subdirectories (recursively). How can I do that?

sudo supervisor -w app.js,api app.js

This doesn't seem to work. It only watches the "api" directory, not its subdirectories.

Share Improve this question asked Nov 23, 2011 at 1:57 user847495user847495 10.2k17 gold badges47 silver badges48 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 10

I just watch all extensions I'm using:

supervisor -e 'js|ejs|less' app.js

Seems to be working and detect changes for me.

If I use this to load the file:

var module = require("./folder/test/variables.js")

And Have a main node file:

var module = require("./folder/test/variables.js")
var http = require('http');

http.createServer(function (request, response) {
   response.writeHead(200, {'Content-Type': 'text/plain'});
   response.end('The variable is '+ module.variable)
}).listen(7777);

Then, just using:

supervisor myApp.js

is going to detect changes in folder/test/variables, which is a subfolder.

Actually, supervisor says it is monitoring the current folder:

DEBUG: Running node-supervisor with
DEBUG:   program 'myApp.js'
DEBUG:   --watch '.'
DEBUG:   --extensions 'node|js'
DEBUG:   --exec 'node'

It is also reloading the files in folder/test if I use:

supervisor -w folder myApp.js

So, I guess you may have a different version of supervisor ? I am using 0.2

本文标签: javascriptIn nodesupervisorhow do I watch everything in a directory for changesStack Overflow