Hi am trying to use request module with promise in nodeJS.
Here is my Script
require('promise'); var request = require('request'); const requestget = function (url) { return new Promise((resolve, reject) { request(url, function (error, response, body) { if (!error && response.statusCode == 200) { resolve(body); } else { reject(error); } }); }); } requestget('http://www.modulus.io').then(console.log); but am getting the following error.
/home/xyz/reques.js:14 return new Promise((resolve, reject) { ^ SyntaxError: Unexpected token { at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3 I really don't know what's wrong in this script any one can help me out.
function (resolve, reject) {or(resolve, reject) => {