[io/http/server/Endpoint listener]
Sets up a listener on an HTTP route. Starts an Express server if one is not started yet.
Keywords: http, server, endpoint, get, post, put, delete, listen, api
Input ports
response:
{"status": number, "headers": {string: string}, "body": string}
params:
{
"serverId": string,
"port": number,
"method": ("GET" or "POST" or "PUT" or "PATCH" or "DELETE"),
"route": string,
optional "host": string,
optional "request": {
optional "bearerToken": string,
optional "contentType": ("text" or "json" or "urlencoded")
},
optional "response": {optional "contentType": ("text" or "json")}
}
Output ports
request:
{
"baseUrl": string,
"body": any,
"cookies": any,
"hostname": string,
"headers": {string: string},
"ip": string,
"ips": string[],
"method": ("GET" or "POST" or "PUT" or "PATCH" or "DELETE"),
"originalUrl": string,
"params": {string: string},
"path": string,
"protocol": ("http" or "https"),
"query": {string: any},
"route": string,
"secure": boolean,
"signedCookies": any,
"stale": boolean,
"subdomains": string[],
"xhr": boolean
}
Sends request received via HTTP.
error: {"error": string, optional "origin": string}
Sends error about incoming request.
server started: (null or {"port": number, "hostname": string})