Debugging Node.js apps with livereload and Docker
This repository is an example of how to run a Node.js program in debug mode from Docker with live reload enabled.
There are two different ways for debugging your Node.js apps.
1 - Using only your terminal
Using only your terminal using the properties below on your docker-compose:
nodejs-debug-docker: stdin_open: true command: npm run debug:terminal ...
After that you'd run
docker-compose run nodejs-debug-docker which will enter in the interactive mode.
You can also run a few commands such as:
list(20)to show the first 10 lines of code.
sb(19)to set a breakpoint on the 19th line.
cto continue the execution after setting the break point.
- You'd run
curl "localhost:3000?number1=10&number2=20"to get your debugger working
exec calculationyou can see the current value stored on
rto restart and so on.
2 - Using your browser which is based on Chromium
Following this repository, you'd run
docker-compose up --build then you'd go to your browser, open your
inpection menu (using
F12) then you'd see your app there