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
const TelegramBot = require( `node-telegram-bot-api` ) | |
const http = require( `axios` ) | |
const token = `385522563:AAFpYSShk-aSj6dg6pMPm4NY4rXTuXef17o` | |
const key = `?api_key=RGAPI-a1503db2-d279-47cb-9f38-e73da6d734fc` | |
const url_id = `https://br1.api.riotgames.com/lol/summoner/v3/summoners/by-name/` | |
const url_level = `https://br1.api.riotgames.com/lol/summoner/v3/summoners/` | |
const url_icone = `https://br1.api.riotgames.com/lol/summoner/v3/icone/` | |
const url_account = `https://br1.api.riotgames.com/lol/summoner/v3/account/` | |
const url_xp = `https://br1.api.riotgames.com/lol/summoner/v3/xp/` |
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
const request = require('request') | |
const rp = require('request-promise') | |
const options = { | |
uri: '', | |
headers: { | |
'User-Agent': 'Suissa-Chain-of-Requests' | |
}, | |
json: true | |
} |
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
const TelegramBot = require( `node-telegram-bot-api` ) | |
const token = `318394911:AAE6OsdVjWyPTxJ1X0Vcf2lzYEeJxPBq52c` | |
const bot = new TelegramBot( token, { polling: true } ) | |
const start = require("./modulos/start") | |
bot.onText( /\/start/, start(bot)) |
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
O passport salva o login do usuario que esta autenticado na em user.username de qualquer requisição. | |
Meu objetivo e mostrar esse username em uma pagina com AngularJS | |
Endpoint API: | |
app.get('/auth/user', function(req, res){ | |
res.send(req.user.login); | |
}); | |
Controller AngularJS: |
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
Modelo 1: | |
const adiciona = (req, res) => | |
model.create(req.body) | |
.then((usuario) => res.json(usuario) ) | |
.catch((erro) => { | |
console.log(erro) | |
res.status(500).json(erro) | |
}) | |
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
Olá, | |
Queria ajuda para refatorar meu serviço AngularJS: | |
angular.module('usuarioServico', ['ngResource']) | |
.factory('recursoUsuario', function($resource) { | |
return $resource('/api/usuarios/:usuarioId', null, { | |
'update' : { | |
method: 'PUT' |
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
Ao cadastrar o ususario, ele cadastra o ususario. | |
Imprime o 'validando form' | |
não imprime nenhum outro console.log | |
angular.module('alurapic') | |
.controller('AuthController', function($scope, $http, $location, recursoUsuario, $routeParams, cadastroDeUsuarios) { | |
$scope.usuario = {}; | |
$scope.mensagem = ''; |
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
O serviço chega a incluir o usuario no banco de dados. | |
Mas vai no catch cadastroDeUsuarios.cadastrar($scope.usuario) | |
Serviço: | |
const MSG = { | |
dontUpdate: ( usuario ) => ({ | |
mensagem: 'Não foi possível atualizar o usuario ' + usuario.login | |
}), | |
dontInsert: ( usuario ) => ( { |
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
// FotoService | |
@Injectable() | |
export class FotoService { | |
http: Http; | |
headers: Headers; | |
url: string = 'http://localhost:3000/v1/fotos'; | |
constructor(http: Http) { | |
this.http = http; |
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
// FotoService | |
@Injectable() | |
export class FotoService { | |
http: Http; | |
headers: Headers; | |
url: string = 'http://localhost:3000/v1/fotos'; | |
constructor(http: Http) { | |
this.http = http; |
OlderNewer