Problems with data node.js (SQL Data)

0

I'm having a question regarding receiving SQL data in an array in JavaScript. I have the login information and everything else, regarding the server, but the issue is not the connection, it's saving the data in an array. Example: nameArray [username, email] (how to require this SQL info?)

app.get('/',(req, res) => {res.render('pages/home')})
function loginClient(){
    var conn = new sql.Connection(dbConfig);
    conn.connect().then(function(){
        var req = new sql.Request(conn);
        req.query("SELECT [CodCliSite],[RazaoSocial],[Email],[Pass] FROM [SITE].
        [dbo].[Clientes]").then(function(recordset){
            res.contentType('application/json');
            res.send(JSON.stringify(recordset));
            console.log(recordset);
            conn.close();
        }).catch(function(err){
            console.log(err);
            conn.close();
        });
    }).catch(function(err){
        console.log(err);
    });
}
return loginClient();
    
asked by anonymous 16.02.2018 / 17:43

0 answers