BadCoder
BadCoder

Reputation: 3

How to get string values in the object with nodejs

When I run my code and it returns {"pass": "123"}. how to get "123" please help me


    app.post("/",urlencodedParser,function(req,res){
        pool.connect(function(err,client,done){
            client.query("select password from account where user='"+req.body.textUser+"'",function(err,result){
                var password = result.rows[0];
                res.send(password);
            });
        });
    });

Upvotes: 0

Views: 699

Answers (1)

maschaub
maschaub

Reputation: 762

password is a dictionary so if you want just the value of pass then you can do this: res.send(password.pass);

Upvotes: 1

Related Questions