node.js - Node Express App debugging with calls from separate client app using WebStorm -
i've looked around , had lot of trouble figuring out. i'm hoping might able point me post or have information on how this.
my problem have 2 projects i've made using webstorm:
- i have 1 application server-side code running on port 3000. it's simple node express app.
- the second application angular 4 / ionic 3 application running client side on port 8100.
i want run server application in debug mode, hits breakpoints data being sent client side app.
for example: angular / ionic app sends request clients given customer. customer sent via url parameter. want server code pause when receives request , can see url parameter. simple.
the server using grunt build project, , nodemon watch it. i'm using npm scripts make life easy. here scripts:
"scripts": { "dev": "set node_env=development && nodemon ./bin/www", "grunt": "grunt", "start": "node ./bin/www" },
nothing fancy.
i have webstorm configured run scripts hitting play. play button first run following sequence:
npm run grunt
npm run dev
again ... nothing fancy.
now how thing setup debugger can listen in webstorm? have both projects open in separate windows, , initiating calls server client. how make break points grab hold , show me data coming server?
i feel incredibly easy , i'm missing stupid. appreciated.
you need starting server in debugger breakpoints in server code hit. if prefer start app via npm script, have add $node_debug_option
(or %node_debug_option%
on windows) make sure node.js started appropriate debug options (--debug-brk
, --inspect-brk
, etc)
so:
- in package.json, modify
dev
script follows:
"dev": "set node_env=development && nodemon %node_debug_option% ./bin/www"
- right-click package.json, choose show npm scripts
- right-click
dev
script in npm tool window opens, choose edit 'dev' settings create run configuration. - open source files in editor, add breakpoints
- press debug start debugging
- run client app, initiate calls server
Comments
Post a Comment