atom-node-debugger icon indicating copy to clipboard operation
atom-node-debugger copied to clipboard

How to debug an express app ?

Open farcasclaudiu opened this issue 9 years ago • 2 comments

I try to debug an express app on Windows10 OS. I only configure the "Node Path" to "C:\Program Files\nodejs\node.exe" Pressing F5 does nothing. If I configure scriptmain to app path "D:\testapp\bin\www" Pressing F5 I get this message on stdout window: "Debugger listening on port 5858" but the webpage is not available on the local web app address. I switch back to Atom and press F5 again, and I get this message in stdout window: "Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process." Now the app seems to be working in browser but all the modules that are working with folders/files are creating new folders and files under www\bin folder instead of app root folder.

Does anyone succeed on debugging express apps Did I miss some configuration? Why is it behaving so?

farcasclaudiu avatar Feb 26 '16 07:02 farcasclaudiu

First the session issue you are seeing is a warning as it says. you will need to use a production worthy SessionStore for that. Mem Store is fine for what it sounds like you are doing for the moment but you should get a real SessionStore module ultimately. Such as connect-mongo or something similar. Mongo obviously being MongoDB.

As to your setup the main script you are looking for is probably something like app.js, server.js or maybe index.js. That is what the debugger is looking for NOT the root folder path as you've specified in your example above.

Hopefully that gets you going!

Constructive criticism here...sounds like you're pretty new to the whole Node deal. I would get familiar with how it all works a bit more first. It will all make a little more sense from there :)

origin1tech avatar Feb 29 '16 20:02 origin1tech

I too am trying to sue this with express. i press f5 on bin/www

Connection attempt 1 to node process on 127.0.0.1:5858 failed. Will try again in 500. Debugger listening on port 5858

but localhost:3000 gives blank page

I have really no idea on how to use it

PS: node-inspector works

DEBUG=ams-api:* node --debug ./bin/www
// then
node-inspector 

awebdeveloper avatar Mar 15 '16 06:03 awebdeveloper