Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.get('/runpr/:ref', function(req, res, next) {
- var p1 = req.params.ref;
- execSQLQuery("EXEC SP_PROCESSA_PREMIO "+p1, function(result, err) {
- var response = '';
- if ( err != null ) {
- // change error to node errors
- response = [{
- A_STATUS: 0,
- MSG: err.originalError.info.message,
- FINISHED: new Date(Date.now())
- }];
- } else {
- response = result.recordset;
- }
- res.json( response );
- });
- function execSQLQuery(sqlQry, callback) {
- var request = new sql.Request();
- request.query(sqlQry, function(err, recordset) {
- callback(recordset, err);
- });
- var config = {
- user: 'xxxx',
- password: 'xxx',
- server: 'xxxx',
- database: 'xxxx',
- connectionTimeout: 500000,
- requestTimeout: 500000
- }
- // listen and timeout
- var server = app.listen(app.get('port'))
- server.timeout = 500000;
Add Comment
Please, Sign In to add comment