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
### Articles | |
type Article { | |
author: Profile! | |
body: String! | |
comments(first: Int, after: String): CommentsConnection | |
createdAt: String! | |
description: String! | |
favorited: Boolean! | |
favoritesCount: Int! | |
slug: String! |
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
ad.findUserAsync(login) | |
.then(function(user){ | |
return ad.authenticateAsync(user.mail, password); | |
}) | |
.then(function(auth){ | |
if(!auth) res.status(403).send({"message": "user not authenticated"}); | |
res.status(200).send({"message": "user authenticated","data": user}); | |
}) | |
.catch(function(err){ | |
return next(err); |
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
//item-order --> esse json que é enviado no POST | |
{ | |
"order": 1, | |
"product": 1, | |
"price": 10, | |
"quantity": 20 | |
} | |
// [POST] /item-order |
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
// [GET] /category | |
function list (request, reply) { | |
this.model | |
.scope({ | |
method: ['user', request.auth.credentials.id] | |
}) | |
.findAndCountAll({ | |
attributes: ['id', 'description'], | |
order: 'description', | |
offset: request.offset, |
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
express.get('/', function(req, res){ | |
http.get('www.outrolugar.com.br/api/', function(err, response){ | |
if(err) | |
res.end(err); | |
res.end(resp.body); | |
}) | |
}) |
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
#!/bin/bash | |
echo "-- PULL before Commit! --" | |
git pull | |
echo "-- Commiting --" | |
git add . --all | |
git commit -am "$3" | |
echo "-- Sending PUSH! " | |
git push -u $1 $2 |
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
// module | |
exports.makePaulo = function (cb) { | |
var ret = {valid: false, data = ''}; | |
request('http://blaablablablbla', function(err, res, body){ | |
ret.valid = true; | |
return ret; | |
}); | |
}; | |
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
var app = require('express')(); | |
var http = require('http').Server(app); | |
var io = require('socket.io')(http); | |
app.get('/', function(req, res) { | |
res.sendfile('index.html'); | |
}); | |
io.on('connection', function(socket) { | |
console.log('um usuario conectado'); |