# Node.js

Source : https://webgune.cloud/en-us/docs/web-nodejs · Mis à jour le 2026-10-27

# Node.js

Any repository containing a `package.json` with a `start` script (and that doesn't match a more specific framework like Next.js) is treated as a generic Node.js service.

## The rule that avoids 90% of problems

```javascript
// ✅ Correct — reachable from Traefik
app.listen(process.env.PORT || 3000, "0.0.0.0");

// ❌ Incorrect — the service reports "Running" but stays unreachable
app.listen(3000, "localhost");
```

`localhost` inside a pod refers only to the pod itself: Traefik, which sits outside, cannot reach it.

## Express

```javascript
import express from "express";

const app = express();
app.use(express.json());

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

const port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0", () => console.log(`listening on ${port}`));
```

## Fastify

```javascript
import Fastify from "fastify";

const app = Fastify();
app.get("/health", async () => ({ ok: true }));

await app.listen({ port: process.env.PORT || 3000, host: "0.0.0.0" });
```

## Process management

The auto builder runs your `start` script directly. If your application needs a process supervisor (automatic restarts, cluster mode), use a [custom start command](/docs/commande-demarrage) with PM2 or equivalent.
