Skip to content

Node.js Hello World

Create a file named index.js with the following content:

const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.json({ message: "Hello World" });
});
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});

Install dependencies and run it locally:

Terminal window
npm init -y && npm install express
node index.js
Terminal window
curl http://localhost:3000
# {"message":"Hello World"}

Ready to deploy? Use the Origin Clouds CLI or SDK to push your app.

Deploy to Origin Clouds →