A library that defines a GET method to do HTTPS requests that emits a Node event
const Request = require("./lib") const request = new Request() // Calling the .GET(url, user) method will launch the 'request emitted' event request.GET('https://dev.to/', 'drozerah') // The listener is listening the 'request emitted' event emitted by the .GET() method let counter = 0 request.addListener("request emitted", (result) => { counter++ result.reqId = counter console.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