Matt Coles лет назад: 9
Родитель
Сommit
1927188954
1 измененных файлов с 24 добавлено и 0 удалено
  1. 24 0
      index.js

+ 24 - 0
index.js

@@ -13,6 +13,12 @@ var scheduler = require("../ip-project-server/presenters/schedule-controller.js"
13 13
 var app = express();
14 14
 var logDirectory = 'log'
15 15
 
16
+/*
17
+
18
+  Basic administration stuff
19
+
20
+*/
21
+
16 22
 // Set up authentication and existing events.
17 23
 var log_passwd = fs.readFileSync('../ip-project-server/logpasswd', 'utf-8');
18 24
 var auth = function (req, res, next) {
@@ -41,6 +47,12 @@ var accessLogStream = FileStreamRotator.getStream({
41 47
 
42 48
 scheduler.register_existing_events();
43 49
 
50
+/*
51
+
52
+  Set up middleware, included logging and headers.
53
+
54
+*/
55
+
44 56
 // Always use SSL, comes first.
45 57
 app.use(forceSSL);
46 58
 
@@ -58,6 +70,12 @@ app.use('/soc-api/*', function(req, res, next) {
58 70
 app.use(morgan('short', {stream: accessLogStream}))
59 71
 app.use(morgan('short'));
60 72
 
73
+/*
74
+
75
+  Set up the individual routes for each part of my portfolio
76
+
77
+*/
78
+
61 79
 // Check the /soc-api/ routes.
62 80
 app.use('/soc-api/v1', route_manager);
63 81
 
@@ -73,6 +91,12 @@ app.use(function (req,res,next) {
73 91
   res.status(404).sendFile(path.resolve('../www_res/404/index.html'));
74 92
 });
75 93
 
94
+/*
95
+
96
+  Below here we set up the servers and choose which ports they will listen on.
97
+
98
+*/
99
+
76 100
 var prkey = fs.readFileSync('key.pem');
77 101
 var certi = fs.readFileSync('cert.pem');
78 102