
This post discusses a potential issue that can arise while utilizing cPanel’s Node.js Selector to operate a Node.js application.
Issue
The Node.js Selector in cPanel is used to develop Node.js applications. The following error prompt appears when you attempt to visit a page created by the app:

The path you are attempting to view is represented by the URL in this error message.
Cause
The Node.js selector utilizes Phusion Passenger to handle Node.js apps. The root path is generated by Phusion Passenger when you build an application in the Node.js Selector using the value entered in the Application URL text box. For instance, if the Application URL text field is placed at myapp, then “/myapp” is the application’s root path instead of “/”.
Solution
Ensure that you include the app URL in your routes in order to fix this issue. The famous Express web application framework is used to display how to accomplish this in the following code sample. It is assumed that myapp is entered in the App URL text field of the cPanel Node.js Selector:

Two routes—/myapp and /myapp/test—are defined in this snippet of code.
If you visit http://example.com/myapp or http://example.com/myapp/test via a web browser and your domain name is www.example.in, the page loads as you would expect. However, you get the “Cannot GET” error if you go to any other URL listed under http://example.in/myapp.
For more assistance, please visit our Host.co.in page.