-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Método POST da API. Separei o arquivo de configuração do Twitter e ma…
…is algumas firulas
- Loading branch information
Showing
8 changed files
with
52 additions
and
50 deletions.
There are no files selected for viewing
File renamed without changes.
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,6 @@ | ||
{ | ||
"consumer_key": "", | ||
"consumer_secret": "", | ||
"access_token_key": "", | ||
"access_token_secret": "" | ||
} |
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 @@ | ||
module.exports = {} |
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,17 @@ | ||
|
||
var ConfigFile = "./Json/twitterConfig.json"; | ||
|
||
/** | ||
* [_createConfig Lê o Json de configuração do Twitter] | ||
* @return {[type]} [description] | ||
*/ | ||
function _createConfig() { | ||
var TwitterConfig = require(ConfigFile); | ||
return TwitterConfig; | ||
} | ||
|
||
module.exports = { | ||
getConfig : function () { | ||
return _createConfig(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,31 @@ | ||
module.exports = function(app) { | ||
|
||
/** | ||
* [tweet GET - Provavelmente este método vai morrer] | ||
* @type {[type]} | ||
*/ | ||
app.get("/tweet/newtweet/:tweet?", function (req, res) { | ||
var tweet = req.params.tweet; | ||
var Twitter = require("../Services/Twitter/newTweet"); | ||
console.log("Chegou na rota"); | ||
Twitter.sendTweet(tweet); | ||
res.send(tweet); | ||
}); | ||
|
||
/** | ||
* [tweet POST - Vai receber um POST com o parâmetro "Tweet" e vai repassar | ||
* a mensagem para a API do Twitter] | ||
* @type {[type]} | ||
*/ | ||
app.post("/tweet/newtweet/", function (req, res) { | ||
var tweet = req.body.tweet; | ||
if (tweet) { | ||
var Twitter = require("../Services/Twitter/newTweet"); | ||
Twitter.sendTweet(tweet); | ||
res.send("Seu tweet: " + tweet + " foi enviado!"); | ||
} else { | ||
res.send("Não informou o Tweet"); | ||
} | ||
|
||
}); | ||
|
||
} |
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 was deleted.
Oops, something went wrong.
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