Overview
simple_web provides high-level HTTP APIs for Eiffel, supporting HTTP client operations, HTTP server development, and ready-to-use AI API clients for Ollama, Claude, OpenAI, and Grok.
Part of the simple_* ecosystem of focused, single-purpose Eiffel libraries.
Quick Start
Installation
- Set environment variable:
export SIMPLE_WEB=/path/to/simple_web - Add to your ECF file:
<library name="simple_web" location="$SIMPLE_WEB/simple_web.ecf"/>
HTTP Server
local
server: SIMPLE_WEB_SERVER
do
create server.make (8080)
server.on_get ("/api/users/{id}", agent handle_user)
server.use (create {SIMPLE_WEB_CORS_MIDDLEWARE}.make)
server.start
end
HTTP Client
local
client: SIMPLE_WEB_CLIENT
do
create client.make
response := client.get ("https://api.example.com/users")
response := client.post_json (url, '{"name": "Alice"}')
end
AI Client
local
ollama: SIMPLE_WEB_OLLAMA_CLIENT
do
create ollama
response := ollama.generate ("llama3", "Hello!")
end
Key Features
HTTP Client
Fluent request builder, libcurl & hybrid modes for reliable requests.
HTTP Server
Agent-based routing with {param} path parameters.
AI Clients
Ready-to-use clients for Ollama, Claude, OpenAI, and Grok.
Middleware
Logging, CORS, Auth (Bearer/Basic/API key) middleware.
Security
Input sanitization for XSS, path traversal, header injection.
JSON Support
Seamless JSON request/response handling with simple_json.
Documentation
- User Guide - Complete tutorial with examples
- API Reference - Full feature documentation
- Architecture - Internal design and rationale
- Cookbook - Real-world recipes and patterns