1

I want to know where and how can i see the moment a variable gives specific content and which content can have, need for return a console message with console.log('not login');, here is my code, this first line works ok:

 authenticated : function(req, res){

        if (req.user) {
            res.redirect('/user');
            //res.send(req.user.username);
            console.log('user enter');

        }
        else {

            res.render('account/login.jade', { title: "Usuario o contraseña incorrecta, si no recuerda su clave puede restablecerla más abajo." });
            console.log('not login');
            res.end;
        }
      },

please, note that question is different from my other question Debugging nodejs with atom IDE

Community
  • 1
  • 1
Marcos R. Guevara
  • 5,258
  • 6
  • 19
  • 44
  • 1
    Can't tell what you're asking for help with. – jfriend00 Apr 28 '16 at 22:32
  • 1
    @jfriend00 Me neither xD – Nonemoticoner Apr 28 '16 at 22:59
  • if you're running your node.js app with [nodemon](https://www.npmjs.com/package/nodemon) you can see the output from `console.log()`. Not sure how to do it otherwise – arne.z Apr 28 '16 at 23:16
  • This is what return the console when i use nodemon:GET /javascripts/autoload.js 304 4.750 ms - - ::ffff:127.0.0.1 - - [29/Apr/2016:07:35:51 +0000] "GET /images/Logo.png HTTP/1.1" 304 - "http://localhost:3000/user/login" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" GET /images/Logo.png 304 1.271 ms - - user enter ::ffff:127.0.0.1 - - [29/Apr/2016:07:36:05 +0000] "POST /user/login HTTP/1.1" 302 66 "http://localhost:3000/user/login" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" – Marcos R. Guevara Apr 29 '16 at 07:38

1 Answers1

0

Solved!

Finally, i found the solution, this video https://www.youtube.com/watch?v=03qGA-GJXjI&feature=youtu.be following the help in this threat debugging node.js with node-inspector helped to do that.

The solution was to:

  1. Start node-inspector in your terminal previously installed with npm.

    node-inspector

  2. Start your node server application.

    node --debug www

  3. Open in Chrome http://127.0.0.1:8080/?port=5858 for see the node-inspector and localhost:3000 (default)

  4. Now, in the inspector set the breakpoint on the line number, click the blue "play" button and go to provoke who triggers the breakpoint.

  5. In the inspector, the browser will remains loading and if you change to the tab on chrome where you have running the node-inspector, you can move the cursor above the req or res and reveal a IncommingMessage dialog with the content of req or res or whatever you use.

This is similar to the related post but not the same, cause here shows specific information for someone who can being searching solution for the same question.

Community
  • 1
  • 1
Marcos R. Guevara
  • 5,258
  • 6
  • 19
  • 44