⚡ REST Code on Demand

The server sends executable code — the client fetches and runs it

1️⃣ Server-Provided Renderer

The client fetches data (/api/products) and a renderer script (/api/scripts/renderer). The server controls how the data is displayed.

2️⃣ Dynamic Price Formatter

The server sends different code depending on the selected locale. Same client — different behavior. Click different buttons and observe how the formatPrice() function changes.

3️⃣ Server-Side Discount Logic

Discount business rules live on the server. The client does not contain them upfront — it fetches them from the /api/scripts/discount endpoint and executes them. When the discount rules change, the client automatically receives the new logic.

📋 Console Log

Tracking all HTTP calls and Code on Demand script executions.