From 25455c0f96c90324478ffedc508b43431673ba55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perlusz=20D=C3=A1vid?= Date: Tue, 3 Sep 2024 13:08:15 +0200 Subject: [PATCH] Update app.js Addint module export for serverless function working --- app.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app.js b/app.js index e69de29..068ea97 100644 --- a/app.js +++ b/app.js @@ -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; \ No newline at end of file