forked from cianclarke/node-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
24 lines (20 loc) · 731 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
// Usage example with ExpressJS
var express = require('express'),
port = process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || 3000,
host = process.env.OPENSHIFT_NODEJS_IP;
var app = express();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static('./'));
// In your project, this would be require('node-gallery')
app.use('/gallery', require('../lib/gallery.js')({
staticFiles : 'resources/photos',
urlRoot : 'gallery',
title : 'Example Gallery',
render : false //
}), function(req, res, next){
return res.render('gallery', { galleryHtml : req.html });
});
app.listen(port, host);
host = host || 'localhost';
console.log('node-gallery listening on ' + host + ':' + port);