Every Membrane program comes with its own URL. By exporting an
function you can quickly handle HTTP requests.
When your program endpoint receives a request it will be logged, so you can
inspect it in the Logs panel.
Accessing an endpoint URL
To access a program’s endpoint URL in your code, call:
await
const nodes: {
readonly clock:Clock;
readonly process:Process;
}
Contains the graph references (grefs) that this program has been given access to.
nodes.
process: Process
process.
Process.endpointUrl: Scalar<string>
The URL of the program's HTTP endpoint.
await nodes.process.endpointUrl
endpointUrl
To open an endpoint, click “Open Preview” above the endpoint function
signature. You can also copy a program’s endpoint by right clicking on it in the
Navigator panel.
http program
In Membrane all communication is done via the graph. So how can fetch make
network requests? Via a special program called http.
There is a special program running on your workspace called http. Whenever you
use fetch, the request will go through the http program which ultimately
makes the actual request.