3. El servicio procesa la request y genera la response

index.html

const respuesta = await consume(
 recibeJson("api/devuelve.php"))
const json =
 await respuesta.json()
alert(
 `Mensaje: ${json.mensaje}
Nombre: ${json.nombre}`)

Hace wait esperando response.

api/devuelve.php

devuelveJson([
 "nombre" => "pp",
 "mensaje" => "Hola."
]);

Procesa la request y
genera response
(respuesta).

Response

HTTP/1.1 200 OK Server: openresty
Date: Sun, 17 May 2026 19:17:52 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0
Expires: Sun, 17 May 2026 19:17:52 GMT
{"nombre":"pp","mensaje":"Hola."}
skip_previous skip_next