9
0
mirror of https://github.com/donlon/cloudflare-error-page.git synced 2025-12-23 16:59:17 +00:00

move nodejs folder to javascript

This commit is contained in:
Anthony Donlon
2025-12-22 23:46:21 +08:00
parent d9af59f14f
commit dd29cf0904
15 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import { render } from '../dist/index.js';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Generate an error page
const errorPage = render({
browser_status: {
status: 'ok',
},
cloudflare_status: {
status: 'error',
status_text: 'Error',
},
host_status: {
status: 'ok',
location: 'example.com',
},
error_source: 'cloudflare',
what_happened: '<p>There is an internal server error on Cloudflare\'s network.</p>',
what_can_i_do: '<p>Please try again in a few minutes.</p>',
});
const outputPath = join(__dirname, 'error.html');
fs.writeFileSync(outputPath, errorPage);
console.log(`Error page generated: ${outputPath}`);
console.log('Open the file in your browser to view it.');