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 rabbit = require('wascally'); | |
var rabbitConfig = { | |
connection: { | |
user: null, | |
pass: null, | |
server: '127.0.0.1', | |
port: 5672, | |
vhost: null | |
}, |
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
function myasyncfunc(param1, param2, callback) { | |
var p4 = param1 + param2; | |
callback(p4); | |
} | |
function DoSomethingSynchronous(){ | |
myasynchfunc(param1,param2, function(p4){ | |
console.log(p4); | |
}) | |
} |
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 fs = require('fs'); | |
var file = __dirname + '/test.json'; | |
var Mongolian = require("mongolian"); | |
var server = new Mongolian; | |
var db = server.db("db"); | |
var collection = db.collection("collection"); | |
fs.readdir('/path/to/html/files', function(err, files) { | |
files.filter(function(file) { return file.substr(-5) == '.json'); }) |
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 express = require('express'); | |
var uuid = require('node-uuid'); | |
var Mongolian = require("mongolian"); | |
var server = new Mongolian; | |
var db = server.db("yourdb"); | |
var sessions = db.collection("sessions"); | |
var users = db.collection("users"); | |
sessions.ensureIndex({ ttl:1 },{ expireAfterSeconds: 60}); //this tells mongo to expire documents in sessions after 60 seconds | |
var app = express(); | |
app.use(express.bodyParser()); |