3. El servicio procesa la request y genera la response
index.html
const respuesta = await consume(
recibeJson("php/devuelve.php"))
const json =
await respuesta.json()
alert(
`Mensaje: ${json.mensaje}
Nombre: ${json.nombre}`)
Hace wait esperando response.
srv/devuelve.php
devuelveJson([
"nombre" => "pp",
"mensaje" => "Hola."
]);
Procesa la request y
genera response
(respuesta).
Response
HTTP/1.1 200 OK
Server: openresty
Date: Fri, 02 May 2025 03:41:22 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0
Expires: Fri, 02 May 2025 03:41:22 GMT
{"nombre":"pp","mensaje":"Hola."}
skip_previous
skip_next