code | type | title | description | order |
---|---|---|---|---|
true |
page |
constructor |
Creates a new Http protocol |
50 |
Use this constructor to create a new instance of the Http
protocol with specific options.
Http(host, [options]);
Argument | Type | Description |
---|---|---|
host |
string |
Kuzzle server hostname or IP |
options |
object |
Http connection 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' }
}
}
A Http
protocol instance.
<<< ./snippets/constructor.js