forked from FieldDB/FieldDBWebServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
36 lines (26 loc) · 937 Bytes
/
Copy pathserver.js
File metadata and controls
36 lines (26 loc) · 937 Bytes
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
var https = require('https')
, express = require('express')
, node_config = require("./lib/nodeconfig_devserver")
, fs = require('fs')
, util = require('util');
//read in the specified filenames as the security key and certificate
node_config.httpsOptions.key = fs.readFileSync(node_config.httpsOptions.key);
node_config.httpsOptions.cert = fs.readFileSync(node_config.httpsOptions.cert);
var app = express();
// configure Express
app.configure(function() {
app.use(express.logger());
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.session({
secret : 'CtlFYUMLlrwr1VdIr35'
}));
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
/*
* Routes
*/
https.createServer(node_config.httpsOptions, app).listen(node_config.port);
console.log(new Date()+" Node+Exress server listening on port %d", node_config.port);