Guest User

Untitled

a guest
Apr 12th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. router.get('/runpr/:ref', function(req, res, next) {
  2.  
  3. var p1 = req.params.ref;
  4. execSQLQuery("EXEC SP_PROCESSA_PREMIO "+p1, function(result, err) {
  5. var response = '';
  6. if ( err != null ) {
  7. // change error to node errors
  8. response = [{
  9. A_STATUS: 0,
  10. MSG: err.originalError.info.message,
  11. FINISHED: new Date(Date.now())
  12. }];
  13. } else {
  14. response = result.recordset;
  15. }
  16.  
  17. res.json( response );
  18. });
  19.  
  20. function execSQLQuery(sqlQry, callback) {
  21. var request = new sql.Request();
  22. request.query(sqlQry, function(err, recordset) {
  23. callback(recordset, err);
  24. });
  25.  
  26. var config = {
  27. user: 'xxxx',
  28. password: 'xxx',
  29. server: 'xxxx',
  30. database: 'xxxx',
  31. connectionTimeout: 500000,
  32. requestTimeout: 500000
  33. }
  34.  
  35. // listen and timeout
  36. var server = app.listen(app.get('port'))
  37. server.timeout = 500000;
Add Comment
Please, Sign In to add comment