diff --git a/app.js b/app.js index 6d9a53c..bc8fd97 100644 --- a/app.js +++ b/app.js @@ -18,6 +18,13 @@ function initApp (config, callback) { app.server = http.createServer(app.express); app.webservice = createClient(config.webservice); + // Express config + app.express.disable('x-powered-by'); + app.express.use(express.static(__dirname + '/public', { + maxAge: (process.env.NODE_ENV === 'production' ? 604800 : 0) + })); + app.express.use(express.compress()); + // View engine app.express.set('views', __dirname + '/view'); app.express.engine('html', hbs.express3({ @@ -29,6 +36,16 @@ function initApp (config, callback) { })); app.express.set('view engine', 'html'); + // Populate view locals + app.express.locals({ + lang: 'en', + year: (new Date()).getFullYear() + }); + app.express.use(function (req, res, next) { + res.locals.host = req.host; + next(); + }); + // Load routes require('./route/index')(app); require('./route/new')(app); diff --git a/public/example.css b/public/example.css new file mode 100644 index 0000000..9c46bea --- /dev/null +++ b/public/example.css @@ -0,0 +1,6 @@ + +/* Just an example CSS file. Delete it when you add actual CSS */ + +body { + font-family: sans-serif; +} diff --git a/view/layout/default.html b/view/layout/default.html index 2a0981a..2ae8b80 100644 --- a/view/layout/default.html +++ b/view/layout/default.html @@ -1,11 +1,13 @@ - + {{block "title"}} + +