mirror of
https://github.com/sstent/node.git
synced 2026-01-26 15:12:37 +00:00
43 lines
959 B
JavaScript
43 lines
959 B
JavaScript
// Generated by CoffeeScript 1.3.1
|
|
var ONE_YEAR, derby, express, expressApp, gzippo, http, path, publicPath, root, server, serverError, todos;
|
|
|
|
http = require('http');
|
|
|
|
path = require('path');
|
|
|
|
express = require('express');
|
|
|
|
gzippo = require('gzippo');
|
|
|
|
derby = require('derby');
|
|
|
|
todos = require('../todos');
|
|
|
|
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(todos.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'));
|
|
|
|
todos.createStore({
|
|
listen: server,
|
|
db: {
|
|
type: 'Mongo',
|
|
uri: 'mongodb://localhost/derby-todos'
|
|
}
|
|
});
|