Give Express a route and a listening port
Use the HTTP app or API profile on Bothosting. Tell Express to listen on 0.0.0.0 and the port in SERVER_PORT. On an HTTP-enabled host, the platform accepts HTTPS at the deployment address and forwards the request to Express. You can prove the route works before connecting a custom domain.
For a small book catalog, save the following as server.mjs. The title is fixed so you know exactly what the first deployment should return. Express’s first application example.
import express from 'express';
const app = express();
app.get('/books/42', (_request, response) => {
response.json({ id: 42, title: 'Field Notes' });
});
app.listen(Number(process.env.SERVER_PORT), '0.0.0.0');Ship the files needed for a clean install
In the project folder on your computer, run npm init -y once for a new project, then npm install express. Keep the resulting package.json and package-lock.json beside server.mjs. Upload those three files at the deployment root. An archive with an extra outer directory puts them below the directory where npm starts.
Set RUN_COMMAND to npm ci && node server.mjs and start. If npm reports a missing lockfile, inspect the uploaded folder before changing the web settings. Node.js package deployment guide.
Test the exact route you shipped
Copy the HTTPS address from Settings and append /books/42. Check for HTTP 200 and the title Field Notes. Opening the bare hostname can show an Express 404 because this example only defines the book route. Once that route works, update one book title, deploy again and check the same address. If you have a custom hostname, repeat the same request there after DNS verification. To add a browser interface, see serving React and Express from one URL. Platform addresses and custom domains.