diff --git a/lib/middleware.js b/lib/middleware.js
index 5726b58..c434e63 100644
--- a/lib/middleware.js
+++ b/lib/middleware.js
@@ -7,17 +7,14 @@ im = require('imagemagick-stream'),
common;
module.exports = function(config){
- var app = express(),
+ var router = express.Router();
staticFiles = config.staticFiles,
common = require('./common')(config),
album = require('./album')(config),
photo = require('./photo')(config);
+
- app.set('views', path.join(__dirname, '..', 'views'));
- app.set('view engine', 'ejs');
-
-
- app.get('/gallery.css', function(req, res, next){
+ router.get('/gallery.css', function(req, res, next){
var fstream = fs.createReadStream(path.join(__dirname, '..', 'css/gallery.css'));
res.type('text/css');
fstream.on('error', function(err){
@@ -27,7 +24,7 @@ module.exports = function(config){
});
// Photo Page
- app.get(/.+(\.(jpg|bmp|jpeg|gif|png|tif)(\?tn=(1|0))?)$/i, function(req, res, next){
+ router.get(/.+(\.(jpg|bmp|jpeg|gif|png|tif)(\?tn=(1|0))?)$/i, function(req, res, next){
var filePath = path.join(staticFiles, req.path),
fstream;
@@ -99,9 +96,9 @@ module.exports = function(config){
});
// Photo Pages - anything containing */photo/*
- app.get(/(.+\/)?photo\/(.+)/i, photo, common.render);
+ router.get(/(.+\/)?photo\/(.+)/i, photo, common.render);
// Album Page - everything that doesn't contain the photo string
// regex source http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word
- app.get(/^((?!\/photo\/).)*$/, album, common.render);
- return app;
+ router.get(/^((?!\/photo\/).)*$/, album, common.render);
+ return router;
}
diff --git a/views/album.ejs b/views/album.ejs
index 674b1ea..7e18b54 100644
--- a/views/album.ejs
+++ b/views/album.ejs
@@ -1,5 +1,3 @@
-
-
<% if (!isRoot){ %>