options Object
host String
port String
baseUrl String
(overwrites host and port)
secure Boolean
(https and wss if true)
- returns a Promise that resolves when client connect
path String
optional, if not give, you will be give a path
handler Function
optional, if not give, will return 200
returns a Listener
(read-only) full url that the listener is listening to
Overwrites the previous handler
Attaches an additional listener to the request
Sends the response with the message str
Sets the header for the response. Field can be an object if setting multiple headers
res.set('Content-Type', 'text/plain');
res.set({
'Content-Type': 'application/json',
'Content-Length': '10',
});
Same as Response.end
but calls JSON.stringify
on the obj first
Sets the status for the respose
Same as calling res.status(statusCode).end()