This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #332 from Rostlab/ranking
Readded SentimentsApi + added Twitter top 5 loved and Twitter top 5 hated
- Loading branch information
Showing
5 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var request = require('superagent'); | ||
var Promise = require('es6-promise').Promise; | ||
var protocol = (process.env.NODE_ENV === 'development') ? 'http://' : process.env.__PROTOCOL__; | ||
var port = (process.env.NODE_ENV === 'development') ? ':8080' : ''; | ||
var baseUrl = protocol + 'localhost' + port + '/'; | ||
|
||
var Api = { | ||
get: function (url, query) { | ||
return new Promise(function (resolve, reject) { | ||
request | ||
.get(baseUrl + url) | ||
.query(query) | ||
.end(function (err, res) { | ||
if (res.status === 404) { | ||
reject(); | ||
} else { | ||
resolve(JSON.parse(res.text)); | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = Api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters