-
Notifications
You must be signed in to change notification settings - Fork 9
/
app.js
37 lines (26 loc) · 858 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
30
31
32
33
34
35
36
37
var express = require('express'),
app = express(),
controller = require('./backend/classes/controller.class'),
plugins = require('./backend/classes/plugins.class.js'),
config = require('./backend/config/configuration'),
mongoose = require('mongoose'),
db = mongoose.connect(config.database);
app.set('view engine', 'jade');
app.use(express.static(__dirname + '/public'));
app.use(express.errorHandler());
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.session({
secret: "My simple node.js CMS"
}));
global.plugins = plugins.initialize(app);
global.db = db;
controller.initialize(app);
['/', /^\/[^cms?].*/i].forEach(function(regex){
app.get(regex, function(req, res){
res.render('frontend/page.ejs', {
path: req.url
});
});
});
app.listen(3000);