9
0
mirror of https://github.com/donlon/cloudflare-error-page.git synced 2025-12-26 18:29:18 +00:00

editor/web: update codegen examples

This commit is contained in:
Anthony Donlon
2025-12-23 22:30:24 +08:00
parent d6cf4bbedb
commit 3d470d55a4
3 changed files with 6 additions and 4 deletions

View File

@@ -532,10 +532,10 @@
Python Example
</button>
<button type="button" data-type="js" class="list-group-item list-group-item-action">
NodeJS Example
JavaScript Example
</button>
<button type="button" data-type="static" class="list-group-item list-group-item-action">
Static Page
Static Webpage
</button>
</div>
<div class="d-flex gap-1 save-as-dialog__buttons">

View File

@@ -3,7 +3,7 @@
* JavaScript Example: Render and serve the Cloudflare error page using Express server
*
* Prerequisits:
* npm install cloudflare-error-page
* npm install express cloudflare-error-page
*/
import express from 'express';
@@ -12,6 +12,7 @@ import { render as render_cf_error_page } from 'cloudflare-error-page';
const app = express();
const port = 3000;
<%# TODO: use the library as middleware? _%>
// Define a route for GET requests to the root URL
app.get('/', (req, res) => {
res.status(<%= errorCode %>).send(render_cf_error_page(<%- indentedParams %>));

View File

@@ -3,7 +3,7 @@
# Python Example: Render and serve the Cloudflare error page using Flask server
#
# Prerequisits:
# pip install cloudflare-error-page
# pip install flask cloudflare-error-page
#
from flask import Flask, request
@@ -11,6 +11,7 @@ from cloudflare_error_page import render as render_cf_error_page
app = Flask(__name__)
<%# TODO: use the library as middleware? _%>
# Define a route for GET requests to the root URL
@app.route("/")
def index():