How to execute code from Node.js server command line?
This question already has an answer here:
V8 comes with an extensive debugger which is accessible out-of-process via a simple TCP protocol. Node has a built-in client for this debugger. To use this, start Node with the debug argument; a prompt will appear:
Node's debugger client doesn't support the full range of commands, but simple step and inspection is possible. By putting the statement debugger; into the source code of your script, you will enable a breakpoint.
http://nodejs.org/api/debugger.html
Yes this is possible. You just need to write the statement debugger
wherever you want your code to stop and you want to use the command line (and start node with the debug argument, eg: node debug app.js
上一篇: 我如何调试Node.js