Skip to main content
Express is the easy case. Write your routes, export the app, let Passenger run it. For the underlying tool, see Node.js.

Before you begin

  • A Node.js app created in cPanel.
  • The app root contains your Express project with package.json.

Wire up the export

1

Edit your entry file (default `app.js`)

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

app.use(express.json());

app.get('/health', (_req, res) => res.json({ ok: true }));

// your routes here

module.exports = app;
No app.listen(). Passenger handles that.
2

Install dependencies

Click Run NPM Install in the cPanel app management page.
3

Restart

Click Restart.

Use environment variables

Express reads from process.env. Add variables in the cPanel UI under Environment variables, then restart for them to take effect:
const dbUrl = process.env.DATABASE_URL;
const apiKey = process.env.STRIPE_SECRET;

Common issues

Add the JSON parser middleware: app.use(express.json()). For form data: app.use(express.urlencoded({ extended: true })).
Install cors, mount before your routes:
const cors = require('cors');
app.use(cors({ origin: 'https://your-frontend.example' }));

Need a hand?

Open a ticket

Best for anything that needs an account check or a config change on our end.

Live chat

Faster for quick questions during business hours.