This file contains hidden or 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
[ { "gentilico" : "afegãne", | |
"nome_pais" : "Afeganistão", | |
"nome_pais_int" : "Afghanistan", | |
"sigla" : "AF" | |
}, | |
{ "gentilico" : "sul-africana", | |
"nome_pais" : "África do Sul", | |
"nome_pais_int" : "South Africa", | |
"sigla" : "ZA" | |
}, |
This file contains hidden or 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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
This file contains hidden or 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
<!doctype html> | |
<html data-ng-app="workshopBeMEAN"> | |
<title>{{ workshop }}</title> | |
<body> | |
<div data-ng-controller='BeerController'> | |
<!-- Exibição do array de cervejas setado no BeerController --> | |
{{ cervejas }} | |
<pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre> |
This file contains hidden or 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 Model = require('./model') | |
, msg = '' | |
, Controller = { | |
create: function(req, res) { | |
var dados = req.body | |
, model = new Model(dados); | |
model.save(function (err, data) { | |
if (err){ | |
console.log('Erro: ', err); | |
msg = err; |
This file contains hidden or 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 http = require("http"); //Core do Node, integrando no protocolo do http | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/bemean'); | |
var db = mongoose.connection; | |
db.on('error', function(err){ | |
console.log('Erro de conexao.', err); | |
}); |