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

+ 24 - 0
index.js

13
 var app = express();
13
 var app = express();
14
 var logDirectory = 'log'
14
 var logDirectory = 'log'
15
 
15
 
16
+/*
17
+
18
+  Basic administration stuff
19
+
20
+*/
21
+
16
 // Set up authentication and existing events.
22
 // Set up authentication and existing events.
17
 var log_passwd = fs.readFileSync('../ip-project-server/logpasswd', 'utf-8');
23
 var log_passwd = fs.readFileSync('../ip-project-server/logpasswd', 'utf-8');
18
 var auth = function (req, res, next) {
24
 var auth = function (req, res, next) {
41
 
47
 
42
 scheduler.register_existing_events();
48
 scheduler.register_existing_events();
43
 
49
 
50
+/*
51
+
52
+  Set up middleware, included logging and headers.
53
+
54
+*/
55
+
44
 // Always use SSL, comes first.
56
 // Always use SSL, comes first.
45
 app.use(forceSSL);
57
 app.use(forceSSL);
46
 
58
 
58
 app.use(morgan('short', {stream: accessLogStream}))
70
 app.use(morgan('short', {stream: accessLogStream}))
59
 app.use(morgan('short'));
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
 // Check the /soc-api/ routes.
79
 // Check the /soc-api/ routes.
62
 app.use('/soc-api/v1', route_manager);
80
 app.use('/soc-api/v1', route_manager);
63
 
81
 
73
   res.status(404).sendFile(path.resolve('../www_res/404/index.html'));
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
 var prkey = fs.readFileSync('key.pem');
100
 var prkey = fs.readFileSync('key.pem');
77
 var certi = fs.readFileSync('cert.pem');
101
 var certi = fs.readFileSync('cert.pem');
78
 
102