2026-05-20
Hello Database Rendering
This is the first placeholder article.
The request flow is intentionally small:
- Sinatra receives the request.
- Sinatra calls a PostgreSQL function.
- PostgreSQL returns a JSON payload with headers and an HTML body.
- Sinatra sends that payload as the HTTP response.
get "/articles/:slug" do
payload = pg_response("select render_article($1)::text as response", [params[:slug]])
send_pg_payload(payload)
end
This keeps the Ruby layer thin while still letting you use Ruby for nice tooling.