Usage with sails.js
See original GitHub issueI’m trying to use this api with sails.js, but the response return the trends response data. The controller function looks like this:
googleTrends.interestOverTime({keyword: [req.param('keyword')]})
.then(function(results){
return res.send(results);
})
.catch(function(err){
return res.json(err);
});
Returns this:
Is there any way to return the data as json object?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Programmatic usage - Sails.js
To create a new Sails app from within a Node.js script, use the Sails constructor. The same constructor can be used to create...
Read more >Advanced usage - Sails.js
A dictionary of all loaded Sails hooks, indexed by their identity. Use sails.hooks to access properties and methods of hooks you've installed to...
Read more >Tutorials - Sails.js
Here you can find step-by-step guides for dealing with a few specific Sails use cases. There's a wealth of great information and tutorials...
Read more >What is Sails? - Sails.js
js. A "back-end web" framework helps you do things like build APIs, serve HTML files, and handle hundreds of thousands of simultaneous users....
Read more >Features | Sails.js
Sails is built on Node.js, a popular, lightweight server-side technology that allows developers to write blazing fast, scalable network appliations in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ohh it looks like there is a return in the first character causing the error. Until I get a fix up, you could
JSON.parse(results.slice(1))
(or you might need to.slice(2)
). Does that work for you?Closing this for now. I think for now we should continue to just pass a string and have the user modify it as they see fit. If we start slicing characters from the string and validating that it is proper JSON, it will be harder to maintain (whenever the api changes we would need to check that it hasn’t changed) and if we say that it is not valid JSON, the user will get nothing back when in reality there may be data available in the string that is formatted slightly differently than we were expecting.