mirror of
https://github.com/sstent/node.git
synced 2026-01-27 15:41:43 +00:00
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
// Generated by CoffeeScript 1.3.1
|
|
var MongoStore, ONE_YEAR, chat, derby, express, expressApp, gzippo, http, path, publicPath, root, server, serverError;
|
|
|
|
http = require('http');
|
|
|
|
path = require('path');
|
|
|
|
express = require('express');
|
|
|
|
gzippo = require('gzippo');
|
|
|
|
MongoStore = require('connect-mongo')(express);
|
|
|
|
derby = require('derby');
|
|
|
|
chat = require('../chat');
|
|
|
|
serverError = require('./serverError');
|
|
|
|
ONE_YEAR = 1000 * 60 * 60 * 24 * 365;
|
|
|
|
root = path.dirname(path.dirname(__dirname));
|
|
|
|
publicPath = path.join(root, 'public');
|
|
|
|
(expressApp = express()).use(express.favicon()).use(gzippo.staticGzip(publicPath, {
|
|
maxAge: ONE_YEAR
|
|
})).use(express.compress()).use(express.cookieParser('secret_sauce')).use(express.session({
|
|
cookie: {
|
|
maxAge: ONE_YEAR
|
|
},
|
|
store: new MongoStore({
|
|
db: 'derby-chat',
|
|
collection: 'express-sessions'
|
|
})
|
|
})).use(chat.session()).use(chat.router()).use(expressApp.router).use(serverError(root));
|
|
|
|
module.exports = server = http.createServer(expressApp);
|
|
|
|
expressApp.all('*', function(req) {
|
|
throw "404: " + req.url;
|
|
});
|
|
|
|
derby.use(require('racer-db-mongo'));
|
|
|
|
chat.createStore({
|
|
listen: server,
|
|
db: {
|
|
type: 'Mongo',
|
|
uri: 'mongodb://localhost/derby-chat'
|
|
}
|
|
});
|