How to Deploy a Node.js Application on Enhance

This guide explains how to deploy a simple Node.js application on an Enhance-hosted website. It covers creating and uploading the application files, configuring SSH access, deploying the app using Enhance's Node.js deployment tool, installing dependencies, and verifying that the application is running successfully. The tutorial includes a sample Express.js application and provides step-by-step instructions for getting a Node.js service online.

1. Log in to Enhance Control Panel

  1. Navigate to Websites.
  2. Click on the desired domain name.

2. Upload Your Application Files

  1. Go to Files.
  1. In your home directory, create a folder called:
my-app
  1. Upload your application files into this folder.

index.js

const express = require('express');
const app = express();

// Use PORT from environment or default to 3000
const PORT = process.env.PORT || 3000;

app.get('/', (req, res) => {
  res.send(`
    <!DOCTYPE html>
    <html>
      <head>
        <title>My Node.js App</title>
        <style>
          body {
            font-family: Arial, sans-serif;
            max-width: 600px;
            margin: 80px auto;
            text-align: center;
          }
          h1 { color: #2c7be5; }
          .badge {
            background: #e8f4fd;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
          }
        </style>
      </head>
      <body>
        <h1>🚀 Node.js App is Running!</h1>
        <p class="badge">Hosted on Enhance</p>
        <p>Server time: ${new Date().toLocaleString()}</p>
        <p>Node version: ${process.version}</p>
      </body>
    </html>
  `);
});

app.get('/health', (req, res) => {
  res.json({
    status: 'ok',
    uptime: process.uptime()
  });
});

// Listen on all interfaces (required for proxying)
app.listen(PORT, '0.0.0.0', () => {
  console.log(`App running on port ${PORT}`);
});

package.json

{
  "name": "demo-node-app",
  "version": "1.0.0",
  "description": "A simple Node.js demo app for Enhance hosting",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "express": "^4.18.2"
  }
}

3. Connect via SSH

If you don't know the SSH password, you can reset it:

  1. In Enhance CP, go to:
  • Websites

  • Select your domain

  • Advanced

  • Developer Tools


  1. Scroll down to SSH Password Authentication.

  2. Click Reset and set a new password.

SSH Example

ssh -p 22 [email protected]

Once connected:

username@s4515:~$ ls

my-app  public_html

Navigate to your application directory:

   username@s4515:~$ cd my-app

4. Deploy the Application

Return to the Enhance Control Panel and deploy the application using the Deploy Node.js tool.

Configure the deployment according to the deployment screen and point it to your my-app directory.


5. Install Dependencies

After the deployment has been created, return to your SSH session and run:

 npm install
run `npm fund` for details 

Your Node.js application should now be successfully deployed on Enhance