Add initial package import and config

pull/101/head
Matthew Macdonald-Wallace 3 years ago
parent ef41a32353
commit 9a1bf6006a

@ -24,6 +24,7 @@
"args-parser": "^1.3.0",
"axios": "^0.21.1",
"bcrypt": "^5.0.1",
"bcryptjs": "^2.4.3",
"bootstrap": "^5.0.2",
"command-exists": "^1.2.9",
"dayjs": "^1.10.6",
@ -31,8 +32,10 @@
"form-data": "^4.0.0",
"http-graceful-shutdown": "^3.1.2",
"jsonwebtoken": "^8.5.1",
"node-gyp": "^3.8.0",
"nodemailer": "^6.6.3",
"password-hash": "^1.2.2",
"prom-client": "^13.1.0",
"redbean-node": "0.0.20",
"socket.io": "^4.1.3",
"socket.io-client": "^4.1.3",

@ -15,6 +15,7 @@ const gracefulShutdown = require('http-graceful-shutdown');
const Database = require("./database");
const {sleep} = require("./util");
const args = require('args-parser')(process.argv);
const prom_client = require('prom-client')
const version = require('../package.json').version;
const hostname = args.host || "0.0.0.0"
@ -32,6 +33,11 @@ app.use(express.json())
* Total WebSocket client connected to server currently, no actual use
* @type {number}
*/
console.log("Setting up the Prometheus Client")
const collectDefaultMetrics = prom_client.collectDefaultMetrics;
collectDefaultMetrics({ prefix: 'uptimekuma' });
let totalClient = 0;
/**
@ -58,6 +64,12 @@ let needSetup = false;
console.log("Adding route")
app.use('/', express.static("dist"));
console.log("Adding /metrics")
app.get('/metrics', function (req, res) {
res.set('Content-Type', prom_client.register.contentType);
res.end(prom_client.register.metrics());
});
app.get('*', function(request, response, next) {
response.sendFile(process.cwd() + '/dist/index.html');
});

Loading…
Cancel
Save