It seems that fs. watchfile is not supported in Windows. I don't want to use iis node, so I spent some time writing a tool to help debug.
This tool can do the following:
Monitors changes to all subdirectories in the main js file. restarts the Node process after changes are made.
Logs can be output to this tool for viewing in the browser.
Usage:
NodeWatcher.exe main. js
All parameters:
Copy codeThe Code is as follows: NodeWatcher.exe main JS program [other optional parameters]
The main JS program must be specified.
-R: [true | false] automatically restarts when an error occurs (node process exits.
Example: NodeWatcher.exe-r false
-E: Which suffix files are to be monitored in the monitored directory. js and node files are used by default.
Example: NodeWatcher.exe-w lib-e js-e node-e json-e xml-e config
-? :
-Help: displays help documents.
Log output allows you to view web pages
Http: // localhost: 2012/
For example:
Node. JS outputs logs to the tool. You can use the console. log statements or call the methods provided by the tool.
Methods provided by the tool:
1 download http: // localhost: 2012/logger. js to the project root directory
2 reference require ("./logger. js ")
3 call:
Logger. log (....)
Logger. error ()
Logger.info ()
Logger. warn ()
Logger. exception (e)
A parameter can be a string or an object. If it is an object, its first-level attribute is output.
Installation:
You don't need to install it, but you need to have. Net framework on your computer. I compiled it with 2.0. Download NodeWatcher.exe and put it in the directory.
: NodeWatcher_jb51.net.rar