diff --git a/CLAUDE.md b/CLAUDE.md index 2593432..5cebe03 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -56,10 +56,13 @@ The entire application is contained in `src/main.rs` with ~372 lines of code. Th ### Key Components -1. **Embedded HTML Frontend**: The HTML/CSS/JavaScript frontend is embedded as a string constant (`HTML_FRONTEND`) directly in the source code, eliminating the need for static file serving. +1. **Embedded HTML Frontends**: Two HTML frontends are embedded as string constants: + - `SIMPLE_FRONTEND`: Minimalist main page with just "No" centered on screen + - `PLAYGROUND_FRONTEND`: Interactive API testing playground with buttons and examples 2. **Request Router**: The `route_request()` function handles all routing logic: - - `/` - Serves the embedded HTML frontend + - `/` - Serves the minimalist "No" page + - `/playground` - Serves the interactive API testing interface - `/api/no` - API endpoint with format parameter support - `/health` - Health check endpoint - CORS headers are added to all responses diff --git a/README.md b/README.md index 27db3da..072c14b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ A lightweight, production-ready HTTP service that always says "no" in various fo ## API Endpoints -- `GET /` - Web frontend +- `GET /` - Minimalist web page displaying "No" +- `GET /playground` - Interactive API testing playground - `GET /api/no` - Returns plain text "no" - `GET /api/no?format=json` - Returns `{"answer": "no"}` - `GET /api/no?format=bool` - Returns `false` diff --git a/src/main.rs b/src/main.rs index 8ff749a..7523540 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,95 @@ use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; use std::thread; -const HTML_FRONTEND: &str = r#" +const SIMPLE_FRONTEND: &str = r#" + +
+ + +