Cloudflare Pages API Demo

Interactive API interface testing with Cloudflare Pages Functions

API Endpoints Overview

GET /api/hello

Basic greeting API. Supports ?name=xxx query parameter.

GET /api/items

List items with optional ?category=xxx and ?search=xxx filters.

POST /api/items

Create a new item. Body: {"name","description","category"}.

PUT /api/items?id=1

Update an existing item by ID.

DEL /api/items?id=1

Delete an item by ID.

GET /api/time

Return server time in multiple formats.

GET /api/random

Generate random data. ?type=number|string|color|uuid|mixed

POST /api/echo

Echo back request details for debugging.

SSE /api/stream

Server-Sent Events demo, streams 10 events at 1s intervals.

POST /api/auth

Token-based auth demo. Login: admin/admin123 or user/user123.

GET /api/hello

Items CRUD Operations

Read Items

Create Item

Update / Delete

GET /api/time

GET /api/random

POST /api/echo

Sends a request to the server and echoes back all request details (method, headers, body, CF metadata).

SSE /api/stream

Server-Sent Events: receives 10 events at 1-second intervals.

Ready

POST /api/auth

Login

Demo accounts: admin/admin123, user/user123

Verify Token