Added /healthz endpoint

This commit is contained in:
Marcus Noble 2021-06-15 04:57:09 +01:00
parent 8f13ad501d
commit 58b92b4628

13
app.js
View File

@ -22,22 +22,25 @@ const moment = require('moment');
const striptags = require('striptags'); const striptags = require('striptags');
const port = process.env.PORT || 8000; const port = process.env.PORT || 8000;
const oneDay = 86400000;
app.use(compress()); app.use(compress());
app.use(express.static(__dirname + '/build')); app.use(express.static(__dirname + '/build'));
// Lets try and slow down some of those exploit crawlers // Lets try and slow down some of those exploit crawlers
app.use("/", require('./filterRoutes')) app.use("/", require('./filterRoutes'));
app.get("/robots.txt", function(reg, res) { app.get("/robots.txt", function(req, res) {
res.send("User-agent: * Disallow: ") res.send("User-agent: * Disallow: ");
}) })
app.get(/\/(feed|rss)\/?$/, function(reg, res) { app.get(/\/(feed|rss)\/?$/, function(req, res) {
res.redirect('/feed.xml'); res.redirect('/feed.xml');
}) })
app.get("/healthz", function(req, res) {
res.sendStatus(200);
})
var md = markdown({html: true}); var md = markdown({html: true});
md.parser.use(emoji); md.parser.use(emoji);