There's a request module on npm which is called the following way:
const request = require('request');
request('http://www.google.com', function (error, response, body) {
// processing
});
I'm using ScalablyTyped bindings which appear to have this method defined here. I am trying to call it but with no luck:
import typings.request.mod.RequestAPI
RequestAPI("http://localhost:8888")
This leads to an error:
[error] -- [E006] Not Found Error: /home/user/Dev/Scala/scalajs-auto-cors/src/main/scala/app/TutorialApp.scala:15:4
[error] 15 | RequestAPI("http://localhost:8888")
[error] | ^^^^^^^^^^
[error] | Not found: RequestAPI
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
I'm not sure how import succeeds but method call doesn't. What would be the right way to properly translate the JS code?