-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
52 lines (40 loc) · 1.23 KB
/
app.js
File metadata and controls
52 lines (40 loc) · 1.23 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var express = require('express'),
app = express(),
bodyParser = require('body-parser'),
mongoose = require('mongoose'),
cookieParser = require('cookie-parser'),
errorHandler = require('errorhandler'),
i18n = require('i18n'),
pages = require('./routes/pages'),
forms = require('./routes/forms');
donations = require('./routes/donations');
langs = require('./routes/langs');
i18n.configure({
locales:['en', 'ar', 'he', 'fr'],
directory: './locales',
defaultLocale: 'en',
cookie: 'lang'
});
app.use(cookieParser())
app.use(i18n.init);
mongoUri = process.env.MONGO_URI || 'mongodb://localhost/waaf';
mongoose.connect(mongoUri);
app.engine('jade', require('jade').__express);
app.set('view engine', 'jade');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(__dirname + '/public'));
var env = process.env.NODE_ENV || 'development';
if (env == 'production') {
app.use(errorHandler());
} else{
app.use(errorHandler({ dumpExceptions: true, showStack: true }));
}
app.use(forms);
app.use(pages);
app.use(donations);
app.use(langs);
app.set('port', process.env.PORT || 3000);
app.listen(app.get('port'), function() {
console.log('Listening on port ' + app.get('port'));
})
module.exports = app;