Skip to content

TypeScript Hello World

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

import express, { Request, Response } from 'express';
const app = express();
const port = process.env.PORT || 3000;
app.get('/', (_req: Request, res: Response) => {
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 && npm install -D typescript @types/express tsx
npx tsx index.ts
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 →