Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
Addint module export for serverless function working
  • Loading branch information
Wathfea committed Sep 3, 2024
1 parent b1fc14e commit 25455c0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const express = require('express');

const app = express()
const PORT = 8000

app.get('/', (req, res) => {
res.send('Hello World')
})

app.get('/about', (req, res) => {
res.send('About route 🎉 ')
})

const start = () => {
try {
const port = process.env.PORT || 3000;
app.listen(port, () =>
console.log(`✅ Server is listening on port ${port}.........`)
);
} catch (err) {
console.error('Failed to start server:', err);
}
};

start();

module.exports = app;

0 comments on commit 25455c0

Please sign in to comment.