Node.js

Built with npm, with the Node.js version it asks for.

On this page

Moorage builds Node.js apps with npm, with the Node.js version the project asks for, and runs the start script — or serves the build's output as a static site when there is none.

The app#

{
  "name": "hello",
  "private": true,
  "scripts": {
    "start": "node server.js"
  },
  "engines": { "node": ">=22" }
}
// server.js
const http = require("node:http");

http
  .createServer((req, res) => res.end(req.url === "/healthz" ? "ok" : "hello from Node.js"))
  .listen(Number(process.env.PORT), "127.0.0.1");

A build script, if there is one (tsc, vite build…), runs after the install.

Commit package-lock.json (npm install makes it). A moorage.toml is optional:

[app]
name = "hello"

[processes.web]
health = { path = "/healthz" }

Deploy#

moor manifest explain
moor deploy

How it builds#

Running it#

A complete app: the Poll example, an Express API with a Vite front end.

Suggest a change to this page