> > module.exports = function(app) { >> const sql = require('mssql'), >> js2xmlparser = require("js2xmlparser"); >> var express = require( "express" ) >> , router = express.Router() >> >> var api = '/api/'; >> var four0four = require('../../utils/404')(); >> > router.get(api + 'virtualmachines', getVirtualMachines); >> >
..... function getVirtualMachines(req, res, next) { for (var key in req.body) { if(req.body[key] === '' ) { req.body[key] = null; } } var vmname = req.body.vmname; var ipaddress = req.body.ipaddress; var vmowner = req.body.vmowner; const pool2 = new sql.ConnectionPool(config, err => { if (err) console.log(err) // ... error checks pool2.on('error', err => { console.log('ConnectionPool', err); }) // Stored Procedure pool2.request() // or: new sql.Request(pool2) .input('vmname', sql.VarChar(50), vmname) .input('ipaddress', sql.VarChar(50), ipaddress) .input('vmowner', sql.VarChar(50), vmowner) .execute('dbo.virtualmachines_sp', (err, result) => { // ... error checks console.log('ConnectionPool', err); //console.dir(result) res.send(result.recordsets[0]) }) }) } -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.