Using Node.js to Run Node.js Programs
Scenarios
Node.js is an open-source project management software. It provides functions such as project management, Wiki, and news, and integrates tools such as GIT, SVN, and CVS. The Node.js application image is running Ubuntu 24.04 and deployed with Docker. It comes pre-installed with Node.js and all required runtime environments. This section describes how to use a Node.js application image to run a Node.js application.
If your Node.js application image was purchased before August 28, 2026, see Using Node.js to Run Node.js Programs (Historical Version) for instructions.
Resource Planning and Costs
| Resource | Configuration | Description |
|---|---|---|
| Cloud server |
| Select appropriate instance specifications based on your service requirements. |
| Image | Node.js | Select the Node.js application image. |
| Network | EIP | By default, a fixed EIP and a fixed private IP address are assigned to a FlexusL instance. |
| Security group | Inbound rule:
| 3000: Tests the Node.js script execution. |
Procedure
| Step | Description |
|---|---|
| Purchase a FlexusL instance and select the Node.js application image. | |
| Add inbound security group rules to ensure that the application pre-installed in the image can be accessed. | |
| Use the Node.js application image to run a Node.js application. |
Step 1: Purchase FlexusL Instances
- Log in to the FlexusL console and click Buy FlexusL.
- Specify required parameters for the FlexusL instance.
Parameter
Example Value
Description
Region
CN-Hong Kong
For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.
Application Images
Node.js
Select the Node.js application image.
Instance Specifications
2 vCPUs | 2 GiB of memory and 60 GiB of the system disk
Select instance specifications as needed.
Instance Name
Node-Example
Customize an instance name that is easy to identify, for example, Node-Example.
(Optional) Associated Services
- Data Disk: 10 GiB
- Host Security
- Cloud Backup Vault: 70 GB
You can bundle any of EVS, HSS (basic edition), and CBR to your FlexusL instances as needed and set specifications as needed.
Required Duration
1 month
Set the required duration.
FlexusL supports auto-renewal. Once enabled, FlexusL instances automatically renew before they expire. If you do not enable auto-renewal during purchase, you can still enable it after your FlexusL instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.
Quantity
1
Set the number of FlexusL instances to be purchased.
- Click Next: Confirm.
On the displayed page, confirm the order details, read and select the agreement, and click Submit.
- Select a payment method and complete the payment.
- Go back to the FlexusL console and view the purchased FlexusL instance.
Step 2: Configure Security Groups
Add inbound security group rules to ensure that the application pre-installed in the image can be accessed.
- Log in to the FlexusL console and click the target resource card or instance name to go to the instance details page.
- In the navigation pane on the left, choose Cloud Servers and click the target server name to view its details.
- On the Security Groups tab, click Add Rule to add the rules listed in the following table.
The following only lists common rules. You can add more rules as needed.
Table 1 Security group rules Priority
Action
Type
Protocol & Port
Source
Description
1
Allow
IPv4
TCP: 3000
0.0.0.0/0
Tests the Node.js script execution.
Step 3: Run the Node.js Program
- Log in to the FlexusL console.
- On the target resource card, choose
> Reset Password to reset the password as instructed. A FlexusL instance does not have an initial password. If you want to log in to a FlexusL instance, set a password for it first. If you have already set a password, skip this step.
For details, see Resetting the Password for a FlexusL Instance.
- Locate the target resource card and click Remote Login. In the displayed dialog box, click VNC Login and enter the username and password to log in to the FlexusL instance. The username is root, and the password is the one you set in the previous step.
For more login methods, see Login Modes.
- After logging in to the cloud server, run the following command to check the Node.js version:
node -v # Or node --version
- Run the following command to check the version of npm (the package manager that comes with Node.js):
npm-v # Or npm--version
- Run the node command to enter the runtime environment. Paste the following example script after the ">" symbol and press Enter to run the script and start the service.
const http = require('http'); const server = http.createServer((req, res) => { res.setHeader('Content-Type', 'text/plain;charset=utf-8'); res.end('Hello World\n'); // After the request is processed, stop the service and exit the process. server.close(() => process.exit(0)); }); server.listen(3000, '0.0.0.0', () => { console.log('hello world'); console.log('Service started. It will automatically stop after handling one request to prevent resource consumption.'); });
- Access the following address in your local browser to view the execution result:
http://<FlexusL-instance-EIP>:3000

What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot