-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (31 loc) · 1.01 KB
/
index.js
File metadata and controls
37 lines (31 loc) · 1.01 KB
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
const express = require('express');
const busboy = require('connect-busboy');
const app = express();
app.use(busboy());
app.get('/*', function(req, res, next) {
console.debug(`GET route: ${decodeURIComponent(req.url)}`);
next();
});
app.post('/*', function(req, res, next) {
console.debug(`POST route: ${decodeURIComponent(req.url)}`);
next();
});
// This handles api requests
require('./api/api')(app);
// This is what the user uses when navigating to the root in the browser
require('./public/public')(app);
let port = 3000;
if (process.argv.length > 2) {
process.argv.forEach(function(param) {
var valIndex = param.indexOf('=')+1;
if(param.includes('--protocol')){
protocol = param.substr(valIndex);
}
else if(param.includes('--port')){
port = param.substr(valIndex);
}
});
}
app.listen(process.env.PORT || port, () => {
console.log(`\x1b[32mPodStats started: \x1b[0mhttp://localhost:${process.env.PORT || port}\n`);
});