When the directory structure of your Node.js application has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');Those suck for maintenance and they're ugly.
| var express = require('express') | |
| , http = require('http') | |
| , connect = require('connect') | |
| , io = require('socket.io'); | |
| var app = express(); | |
| /* NOTE: We'll need to refer to the sessionStore container later. To | |
| * accomplish this, we'll create our own and pass it to Express | |
| * rather than letting it create its own. */ | |
| var sessionStore = new connect.session.MemoryStore(); |
| # References: | |
| # http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/ | |
| # http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/ | |
| # | |
| global | |
| nbproc 2 | |
| maxconn 16384 | |
| defaults |
When the directory structure of your Node.js application has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');Those suck for maintenance and they're ugly.
| exports.ext = function () { | |
| var extTypes = { | |
| "3gp" : "video/3gpp" | |
| , "a" : "application/octet-stream" | |
| , "ai" : "application/postscript" | |
| , "aif" : "audio/x-aiff" | |
| , "aiff" : "audio/x-aiff" | |
| , "asc" : "application/pgp-signature" | |
| , "asf" : "video/x-ms-asf" | |
| , "asm" : "text/x-asm" |
| // Use: var tree = new OST(); tree.select(4); tree.insert(key,value) | |
| var OST = function () { | |
| // Order statistic tree node | |
| var Node = function (leftChild, key, value, rightChild, parent) { | |
| return { | |
| leftChild: (typeof leftChild === "undefined") ? null : | |
| leftChild, | |
| key: (typeof key === "undefined") ? null : key, | |
| value: (typeof value === "undefined") ? null : value, | |
| rightChild: (typeof rightChild === "undefined") ? null : |