Closed romulo-rocha closed 7 years ago
@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.
Thank you so much for your support!
Well, I am trying to use it on my web application which is not using a Node back-end (maybe that's the problem). I am working with Laravel framework (PHP) and AngularJS. If there's a way to use it in regular back-end services, I'd be very appreciated.
Take care!
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.
Thanks @Dayjo. I'm planning to change the package up to remove request
and request-promise
dependencies and also incorporate the ability to make requests from the front-end
Hey i installed it by using browserify
but its says
bundle.js:1 Uncaught Error: Cannot find module '/node_modules/google-trends-api/lib/utils/index.js'
Well can anyone explain how can i resolve this error.
I'm getting basically the same error as @lakshsyal123 and am also using Browserify via wzrd. The exact text is:
Uncaught Error: Cannot find module '/node_modules/google-trends-api/lib/utils/'
I went through and changed a few of the require
s from e.g.
require(__dirname + '/lib/utils/')
to
require('./lib/utils/')
and that allowed execution to proceed to the next dependency.
I'll be adding a patch soon that will remove the node specific code so the library can be used in the browser.
Closed in PR #44
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