-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (51 loc) · 1.5 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Johan Coppieters - jan 2013 - Cody CMS
//
// website for Cody CMS
//
//
var cody = require('cody');
var express = cody.express;
var fs = cody.fs;
var mysql = cody.mysql;
var ejs = cody.ejs;
cody.server = express();
var bodyParser = cody.bodyParser;
var expressSession = cody.expressSession;
var multer = cody.multer;
// use the new 4.x middleware
cody.server.use(bodyParser());
cody.server.use(expressSession({secret: 'a secret', cookie: { maxAge: 60*60*1000 }}));
cody.server.use(bodyParser.urlencoded({ extended: true }));
cody.server.use(multer());
// startup a routing for all static content of cody (images, javascript, css)
cody.server.get("/cody/static/*", function (req, res) {
var fileserver = new cody.Static(req, res, "");
fileserver.serve();
});
cody.startWebApp(cody.server, {
"name": "bok",
"mailFrom": "[email protected]",
"smtp": "smtpmailer.howest.be",
"version": "V0.1",
"defaultlanguage": "en",
"hostnames" : "bok.coppieters.be,bok.local,bok.bike,www.bok.bike",
"dbuser": "cody",
"dbpassword": "ydoc",
"dbhost": "localhost",
"datapath": "/usr/local/data/bok",
"db": "bok",
"controllers": require("./controllers/")
},
function() {
console.log("Loaded BOK web app....");
var portNr = 3002;
cody.server.listen(portNr);
console.log('Listening on port ' + portNr);
}
);
if (!process.stderr.isTTY) {
process.on('uncaughtException', function (err) {
console.error('Uncaught exception : ' + err.stack);
});
}