POST handler
Last updated
Last updated
[sdks/expressjs/utils/POST handler]
Receives POST requests on the specified route and dispatches the corresponding response. Example:
"my-express-server"@0 received on app ID
"/users/"@0 received on route
a client POST request received by express with URL "http://api.mydomain.com/users/
the following signals are sent to other node(s) processing the request
{
"accept": "application/json"
}@0 sent on headers
{ "name": "John Doe", "age": 27 }@0 sent body
The following signals are received back from processing nodes and sent out to the client:
200@0 on status
,
{
"content-type": "application/json"
}@0 on headers
,
{ id:2, "name": "John Doe", "age": 27 }@0 on body
null@0 sent on done
Keywords: api, request, response
app ID: string
The id of the express instance. Example: "my-express-server"
route: (string or string[])
Receives the route(s) to handle requests for. Route be specified as exact match (1) or as pattern match (2). Example:
"/status" will just match "/status"
"/s*s" will match "status", "shoes", etc..
status: number
Receives the HTTP status code to be sent with the response to the client. Example: 200
headers: {string: string}
Receives the HTTP headers to be sent with the response to the client. Example: { "content-type": "application/json" }
body: any
Receives the content to send to the client as response body. Example:
"OK"
3.14
{ "status": "OK" }
headers: {string: string}
Forwards the headers of the request to be processed. Example: { "content-type": "application/json" }
body: any
Forwards the body of the request to be processed. Example:
"OK"
3.14
{ "status": "OK" }
done: any
Event triggered when the request has been processed.
error: {"error": string}
Sends error information in case the request could not be handled.