This commit is contained in:
8
index.js
8
index.js
@@ -4,19 +4,23 @@ const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("🚀 Home Route Working");
|
||||
res.json({
|
||||
status: "OK",
|
||||
message: "Home Route Working"
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/health", (req, res) => {
|
||||
res.json({
|
||||
status: "OK",
|
||||
message: "Server is healthy ✅"
|
||||
message: "Server is healthy"
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
// only start server if not testing
|
||||
// It ensures the server starts only when the file is run directly, not when it is imported for testing.
|
||||
if (require.main === module) {
|
||||
app.listen(3000, () => {
|
||||
console.log("Server running on port 3000");
|
||||
|
||||
Reference in New Issue
Block a user