Build a REST API in Plain English¶
This guide builds a working JSON REST API in EPL — a programming language whose
keywords are ordinary English. If you can read a sentence, you can read this API.
Every snippet below is runnable; copy it, run it, and hit it with curl.
Install: pip install eplang · Try in the browser (no install):
EPL Playground
The smallest possible API¶
Create a file api.epl:
Create WebApp called app
Route "/api/greeting" responds with
Send json Map with message = "Hello from EPL" and status = "ok"
End
Start app on port 8000
Run it:
Then in another terminal:
That's a complete HTTP JSON endpoint. No framework to install, no boilerplate,
no decorators — Create WebApp, Route ... responds with, Send json.
Returning a list of records¶
A Map is EPL's key–value object (like a JSON object / Python dict). A list of
maps is a JSON array of objects:
Create WebApp called app
Route "/api/users" responds with
users = [Map with name = "Ada" and role = "admin", Map with name = "Bob" and role = "user"]
Send json Map with data = users and count = length(users)
End
Start app on port 8000
length(users) is a built-in — no import required.
Multiple routes and a health check¶
Real services expose several endpoints. Add as many Route blocks as you need:
Create WebApp called app
Route "/api/greeting" responds with
Send json Map with message = "Hello from EPL" and status = "ok"
End
Route "/api/users" responds with
users = [Map with name = "Ada" and role = "admin", Map with name = "Bob" and role = "user"]
Send json Map with data = users and count = length(users)
End
Route "/health" responds with
Send json Map with status = "healthy"
End
Start app on port 8000
A /health endpoint that returns {"status": "healthy"} is exactly what a load
balancer or Kubernetes liveness probe expects.
How this compares¶
The same greeting endpoint in three languages:
EPL reads as instructions, not symbols — which is the point. It's approachable for beginners and non-native English speakers learning to program, while still running on a real toolchain (interpreter, bytecode VM, and native compiler).
Going to production¶
epl serve is the development server. For production, EPL generates WSGI/ASGI
adapters and deployment manifests:
pip install "eplang[server]"
epl serve api.epl --csp # strict Content-Security-Policy
epl deploy k8s api.epl --image myapi:1.0 --tls
See the Web Guide for routing, sessions, templates, and the security model, and Deployment for packaging.
Next steps¶
- Todo app with SQLite — persist data, not just return it
- Web Guide — pages, forms, sessions, static files
- Try it live in the browser
- Star EPL on GitHub if this was useful