Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.05 KB

File metadata and controls

59 lines (43 loc) · 2.05 KB
code type title description order
true
page
constructor
Creates a new Http protocol
50

Constructor

Use this constructor to create a new instance of the Http protocol with specific options.

Arguments

Http(host, [options]);

Argument Type Description
host
string
Kuzzle server hostname or IP
options
object
Http connection options

options

Http protocol connection options.

Property Type
(default)
Description
customRoutes
object

({})
Add custom routes
headers
object

({})
Default headers sent with each HTTP request
port
number

(7512)
Kuzzle server port
sslConnection
boolean

(false)
Use SSL to connect to Kuzzle server
ssl
boolean

(false)
Use SSL to connect to Kuzzle server. Defaults to true for ports 443 and 7443.
timeout
number

(0)
Connection timeout in milliseconds (0 means no timeout)

Note:

customRoutes are used to define plugins API routes or to overwrite existing API routes.
They must have the following format:

{
  'my-plugin/my-controller': {
    action: { verb: 'GET', url: '/some/url' },
    action2: { verb: 'GET', url: '/some/url/with/:parameter' }
  }
}

Return

A Http protocol instance.

Usage

<<< ./snippets/constructor.js