forked from litten/zing-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (25 loc) · 875 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require('events').EventEmitter.prototype._maxListeners = 100;
var resize = require('./lib/resize'),
cfg = require('./config'),
express = require('express'),
port = process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || 3000,
host = process.env.OPENSHIFT_NODEJS_IP;
var photosPath = './resources/photos';
resize.init(photosPath)
var app = express();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/assets/dist/'));
app.use('/', require('./lib/gallery.js')(Object.assign({
staticFiles : 'resources/photos',
urlRoot : '/',
title : 'Zing Gallery',
render : false
}, cfg)), function(req, res, next){
return res.render('gallery', Object.assign({
galleryHtml : req.html
}, cfg));
});
app.listen(port, host);
host = host || 'localhost';
console.log('zing-gallery listening on ' + host + ':' + port);