I'm creating a desktop application using Node.JS that talks to SQL Server for MAC users .
Is it possible in Node.JS to take the input from the user and display the data from SQL server based on user input?
For example, in the code below, can I put an input box onload and allow user to input customercodeand display InvoiceNumber and customername.
Also, will I be able to run the below code on MAC?
var http = require('http');
var edge = require('edge');
var port = process.env.PORT || 8080;
var getTopUsers = edge.func('sql', function () {
/* SELECT TOP 5 * FROM InvoiceHeader ORDER BY InvNumber DESC */
});
function logError(err, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write("Error: " + err);
res.end("");
}
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' });
getTopUsers(null, function (error, result) {
if (error) { logError(error, res); return; }
if (result) {
res.write("<ul>");
result.forEach(function(user) {
res.write("<li>" + user.InvNumber + " " + user.CompanyCode + ": " + user.CompanyName + "</li>");
});
res.end("</ul>");
}
else {
}
});
}).listen(port);
console.log("Node server listening on port " + port);