juanpastas juanpastas - 1 month ago 21
Javascript Question

Reload Express.js routes changes without restarting server

I tried

express-livereload
, but it just reloaded view files.

Should I use another tool, or this one can be configured to watch for my
index.js
file which runs the server?

I read that options are the same as
node-livereload
, and default for watched files include
.js
files.

Any URL you know with a simple configuration?

My main problem is how to setup good development environment for Express.js, and I would like to inspect the variables when I am making a request, is painful to restart each time I make a change in a route.

PS I tried
node-inspector
to inspect variables when server handles a request, but it seems
node-inspector
is not intended for that, right?

Answer

I think Nodemon has what you're looking for.

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.

Example invocation:

nodemon index.js
Comments