question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not getting how to have api functioning with 'require'

See original GitHub issue

I know this is an ignorance of mine and not an issue with the code. Firstly, I’d like to thank the author of this repository.

Could you explain how do I get this api functioning on my application? I know it all starts with:

var googleTrends = require('google-trends-api') But that’s exactly where I am failing to succeed at using the plugin. 😦 Now I know it’s dumb, lol but please have mercy on me.

I’ve downloaded requirejs from http://requirejs.org/ and included it on my page. But when I manage to require the plugin, it doesn’t recognize “module.exports” or the “_dirname” variable. I don’t quite understand this require Javascript solution.

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Dayjocommented, Nov 1, 2016

You might be able to get this working with something like browserify which allows you to require, and then compiles for web. However some of the modules used (‘require-promise’) may not work, and potentially would need to be switched out for an XHR library.

1reaction
pat310commented, Sep 28, 2016

@romulo-rocha I’ll have to rewrite some things to add support for directly using the library in the browser (assuming there are no CORS issues). For now, if you have a node back-end you should be able to require the library in there. I’ll keep this issue open until that is complete.

Read more comments on GitHub >

github_iconTop Results From Across the Web

External API Calls With Express, Node.JS and Require Module
You need to take the data you get from request() and send it back as the response to the original web server request....
Read more >
The API is not working for me. What should I do?
1. Check that you are including your API key in your API calls. · 2. Check that you have permission to access the...
Read more >
Top 3 Reasons for API Failures | Blazemeter by Perforce
Go to the Source. The documentation that you are working from may not be up to date. If you get it directly from...
Read more >
How to Debug Web API Problems in 4 Steps - Kill All Defects
Diagnosing API Issues · Step 1: Get Information on the Web Request · Step 2: Identify the Problem Area · Step 3: Divide...
Read more >
Not getting any response from the API I am calling from the ...
I have gone through the blog - How do I call my API from an Action? ... PASSWORD } }; axios.request(options).then(function (response) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found