Enabling Node.js

Use the enable operation:

  • To enable a Node.js version on the server (available to Administrator only),
  • To enable Node.js support on a domain.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

The request XML packet enabling a Node.js on the server or on a domain includes the enable operation node:

<packet>
  <extension>
    <call>
      <nodejs>
        <enable>
          ...
        </enable>
      </nodejs>
    </call>
  </extension>
</packet>

The enable node contains the following nodes:

  • The version node is optional. It specifies the Node.js version. Data type: string.
  • The domain node is optional. It specifies the domain name. Data type: string.
 

Response Packet Structure

The output XML packet is structured as follows:

<packet>
  <extension>
    <call>
      <result>
        <status>...</status>
        ...
        <nodejs>
          <enable/>
        </nodejs>
      </result>
    </call>
  </extension>
</packet>
  • The result node is required. It wraps the response received from the server. This node contains the following nodes:
    • The status node is required. It specifies the execution status of the enable operation. Data type: result_status. Allowed values: ok | error.
    • The errcode node is optional. It is used to return the error code when the enable operation fails. Data type: unsignedInt.
    • The errtext node is optional. It is used to return the error message if the enable operation fails. Data type: string.
    • The nodejs node is optional. It is present if the operation was completed successfully and contains the enable node.
 

Samples

This request XML packet enables Node.js version 6.3.1 support on the domain example.com:

<packet>
  <extension>
    <call>
      <nodejs>
        <enable>
          <version>6.3.1</version>
          <domain>example.com</domain>
        </enable>
      </nodejs>
    </call>
  </extension>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.8.0">
  <extension>
    <call>
      <result>
        <status>ok</status>
        <nodejs>
          <enable/>
        </nodejs>
      </result>
    </call>
  </extension>
</packet>
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.