Commit
chore: setup Express and add /health route
Commands
npm install express
npm install --save-dev @types/express
Files
📄 src/app.ts
import express from "express";
const app = express();
app.get("/health", (_req, res) => {
res.status(200).json({ status: "ok" });
});
export default app;
📄 src/server.ts
import app from "./app";
const PORT = process.env.PORT || 3001;
app.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}`);
});
📄 Update package.json
(in "scripts")
"scripts": {
"dev": "tsx watch src/server.ts"
}
Verification
- Run the development server:
npm run dev
- Open your browser or use a tool like Postman:
GET http://localhost:3001/health
- Expected response:
{ "status": "ok" }
Next step:
chore: add Jest and Supertest with health route test