Hi,
I am new to LightningJS. I’m trying to get data from other websites, but there is an error importing the request package.
import request from ‘request’
export function req (url){
request.get(url, ( err, res ) => {
console.log(res)
})
}
Hi,
I am new to LightningJS. I’m trying to get data from other websites, but there is an error importing the request package.
import request from ‘request’
export function req (url){
request.get(url, ( err, res ) => {
console.log(res)
})
}
Hi Salhl,
are you using this module? request - npm. It is deprecated and unnecessary for Lightning.
In Lightning, try to use Fetch: Using the Fetch API - Web APIs | MDN
If you’ve not come across the Fetch API before, drop me a note and I can try to assist.
Hi JacobReilly-Cooper,
Thank you for your help. I tried the fetch API and the problem is solved.
Brilliant, Salhl.
Really glad it worked!
I understand that you are encountering an error related to the ‘request’ package. The ‘request’ package is a popular HTTP client library used in Node.js for making HTTP requests to external resources.
If you are facing an issue with importing the ‘request’ package, there are a few things you can check and try to resolve the problem:
For more information check this: https://yardgearsguide.com/how-to-test-small-engine-ignition-coil-without-multimeter/