A library that defines a GET method to do HTTPS requests that emits a Node event
constRequest=require("./lib")constrequest=newRequest()// Calling the .GET(url, user) method will launch the 'request emitted' eventrequest.GET('https://dev.to/','drozerah')// The listener is listening the 'request emitted' event emitted by the .GET() methodletcounter=0request.addListener("request emitted",(result)=>{counter++result.reqId=counterconsole.log(result)})// return// { statusCode: 200,// reqErr: false,// url: 'https://dev.to/',// user: 'drozerah',// userPath: 'https://dev.to/drozerah',// reqId: 1 }Useful links:
- Node.js - inheriting from EventEmitter - stack overflow
- Node.js events doc
- Node.js EventEmitter
Author:
- Thomas G. aka Drozerah - GitHub
License:
- ISC © Thomas G. aka Drozerah