This article demonstrates step-by-step how to create a simple application using node.js on Plesk Onyx for Windows. Differences between Plesk Onyx for Windows and other types of installations are highlighted.
To access the Plesk control panel, follow these steps:
To create the necessary directory and file, follow these steps:
On the toolbar at the top of File Manager, click the New list box, and then click :
In the Create a Directory dialog box, in the Directory name text box, type hello_world, and then click :
On the directory tree at the left of File Manager, click the newly created hello_world directory:
On the toolbar at the top of File Manager, click the New list box, and then click Create File:
In the Create a File dialog box, in the File name text box, type app.js, and then click :
In the right hand pane of the File Manager, click the name of the new file to open it in the code editor:
Copy and paste the following code into the editor, then click
const http = require('http'); http.createServer(function(request, response) { response.writeHead(200, {'Content-Type': 'text/html'}); response.end('<H1>Hello World!</H1>'); }).listen(process.env.PORT); console.log('App is running…');
To configure node.js and start the application, follow these steps:
On the node.js configuration page, click the name of the Application Root. A directory tree dialog box appears.
In the directory tree dialog box, click the hello_world directory, and then click
Still on the node.js configuration page, click the name of the Document Root. A directory tree dialog box appears.
In the directory tree dialog box, click the hello_world directory, and then click
Inspect the Application Startup File setting. It should be set to app.js by default. If it is not set to app.js, click the file name. The Application Startup File dialog box appears.
Replace the name in the text box with app.js, and click
Click
Click on the Application URL. A new tab opens and displays the Hello World! page.
For more information about Node.js, please visit https://nodejs.org.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.