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
'use strict'; | |
/** | |
* Module dependencies. | |
*/ | |
var favicon = require('serve-favicon'), | |
morgan = require('morgan'), | |
compression = require('compression'), | |
bodyParser = require('body-parser'), | |
methodOverride = require('method-override'), |
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
{ | |
"name": "Yonatan Ellman", | |
"age": 29, | |
"pob": "Cape Town South Africa", | |
"blog": "blog.nodeside.com", | |
"email": { | |
"personal": "[email protected]", | |
"work": "[email protected]" | |
}, | |
"quotes": [ |
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
Some of the files/folders are excluded. The structure here is a general overview | |
config | |
--env/ (per environment) | |
--express.js (reduced express file) | |
packages/ | |
----auth | |
----system | |
----articles/ (scaffolded example) |
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
map = function() { | |
emit(this.suit,{count:1}); | |
} | |
reduce = function(key, values) { | |
var total = 0; | |
for ( var i=0; i<values.length; i++ ) | |
total += values[i].count; | |
return { count : total }; | |
} |
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
ps -p <PID> -o pid,vsz=MEMORY -o user,group=GROUP -o comm,args=ARGS |
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
#Ubuntu and OSX | |
lsof -i tcp:<PORT> | |
#Ubuntu | |
netstat -tulpn | grep --color :<PORT> | |
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
#Upstart Service For Nodejs in /etc/init | |
description 'nodejs example upstart' | |
author 'Yonatan Ellman (blog.nodeside.com) adpated from ivarprudnikov.com' | |
env NAME=TEST | |
env LOG_FILE=/var/log/nodejs-test.log | |
env USER=nodejs | |
env NODE_BIN=/usr/local/bin/node | |
env NODE_ENV="development" | |
env PORT=3001 |
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
// Simulate some slow I/O task | |
function blockingIO(callback) { | |
// Delay of 3 seconds | |
setTimeout(function() { | |
callback("The blocking task has been completed"); | |
}, 3000); | |
} | |
// A demo callback function | |
function doThisWhenFinished(message) { |
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
netstat -anp | grep -w <PORT> | grep ESTABLISHED | wc -l |
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 dependable = require('dependable'), | |
container = dependable.container(); | |
// Could be your db connection | |
var mongoose = {} | |
// Random dependency | |
container.register('anotherDependency', 'I do nothing right now'); | |
// The dbAdmin "module" could be another that we want to make that might |