Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js IncomingMessage Object

❮ requestListener


Example

The IncomingMessage object is passed as the first argument in the requestListener function:

var http = require('http');
http.createServer(function (req, res) {
  res.end(req.url);
}).listen(8080);
Run example »

Definition and Usage

The IncomingMessage object represents the request to the server.


IncomingMessage Methods and Properties

destroy()  
headers Returns a key-value pair object containing header names and values
httpVersion Returns the HTTP version sent by the client
method Returns the request method
rawHeaders Returns an array of the request headers
rawTrailers Returns an array of the raw request trailer keys and values
setTimeout() Calls a specified function after a specified number of milliseconds
statusCode Returns the HTTP response status code
socket Returns the Socket object for the connection
trailers Returns an object containing the trailers
url Returns the request URL string

❮ requestListener