January 2018
Intermediate to advanced
336 pages
7h 22m
English
The Request module aims to simplify making HTTP requests, particularly when it comes to streaming data. It’s true that Node.js ships with a built-in module called http, which has APIs for creating low-level HTTP servers and making client requests. But using the Request module cuts past many of the details so you can focus on the job being done.
As an introduction to using the Request module, open your text editor to your index.js file and insert the following code after the url command.
| | program |
| | .command('get [path]') |
| | .description('perform an HTTP GET request for path (default is /)') |
| | .action((path = '/') => { |
| | const options = { |
| | url: fullUrl(path), |
| | json: program.json, |
| |
Read now
Unlock full access