Skip to content
Node.js

http API Reference

Node.js http module for building HTTP servers and issuing HTTP clients requests.

By EZ4Code Team

http

Server and client utilities from the http module.

http.createServer(requestListener?) -> http.Server

Returns a new HTTP server that invokes the listener for each request.

Returns: http.Server

http.request(options, callback?) -> http.ClientRequest

Initiates an HTTP request and returns the ClientRequest; emit 'response' or pass a callback.

Returns: http.ClientRequest

server.listen(port, hostname?, callback?) -> server

Starts listening for connections on the given port and optional hostname.

Returns: http.Server

http.get(options, callback?) -> http.ClientRequest

Convenience method for GET requests; auto-calls req.end().

Returns: http.ClientRequest

More Node.js API References