Files
everything-is-fine/index.js
2026-01-16 20:56:40 +01:00

35 lines
1.5 KiB
JavaScript

import express from 'express';
import { render as render_cf_error_page } from 'cloudflare-error-page';
const app = express();
app.get("/", (_req, res) => {
res.status(200).send(render_cf_error_page({
"title": "Web server is working",
"error_code": "200",
"more_information": { "hidden": true },
"browser_status": { "status": "ok", "status_text": "Seems Working" },
"cloudflare_status": { "status": "ok", "status_text": "Often Working", location: "Where ever you are" },
"host_status": { "status": "ok", "location": _req.headers.host, "status_text": "Almost Working" },
"error_source": "host",
"what_happened": "<p>This site is still working. And it looks great.</p>",
"what_can_i_do": "<p>Visit the site before it crashes someday.</p>"
}));
});
app.get("/broken", (_req, res) => {
res.status(200).send(render_cf_error_page({
"title": "Web server is on fire",
"error_code": "666",
"more_information": { "hidden": true },
"browser_status": { "status": "error", "status_text": "Ram on fire" },
"cloudflare_status": { "status": "error", "status_text": "Fiber cable + Shark", location: "Hell" },
"host_status": { "status": "ok", "location": _req.headers.host, "status_text": "Atleast its not the sysadmin" },
"error_source": "host",
"what_happened": "<p>Its HOT in hell</p>",
"what_can_i_do": "<p>Cry</p>"
}));
});
app.listen(3000);