To access a node.js application from a browser, use the sequence below in an .htaccess file:

RewriteEngine On
RewriteRule ^$ http://127.0.0.1:xxxx/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:xxxx/$1 [P,L]

Replace .htaccess xxxx with the port on which your application is running. If the application does not start, check the logs for error codes (eg EADDRINUSE) and try using another port.

Was this answer helpful? 1 Users Found This Useful (1 Votes)