Skip to content

Commit

Permalink
index added
Browse files Browse the repository at this point in the history
  • Loading branch information
aparnajyothi-y committed Oct 29, 2024
1 parent 5e1f5f6 commit e8e6be1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// src/index.js

const express = require('express'); // Import the Express module
const app = express(); // Create an Express application

// Define a route for the root URL
app.get('/', (req, res) => {
res.send('Hello, World!'); // Send a response to the client
});

// Define a route for a different URL
app.get('/about', (req, res) => {
res.send('About this application'); // Response for the /about route
});

// Set the server to listen on a specific port
const PORT = process.env.PORT || 3000; // Use PORT from environment or default to 3000
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`); // Log the server URL
});
20 changes: 20 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// src/index.js

const express = require('express'); // Import the Express module
const app = express(); // Create an Express application

// Define a route for the root URL
app.get('/', (req, res) => {
res.send('Hello, World!'); // Send a response to the client
});

// Define a route for a different URL
app.get('/about', (req, res) => {
res.send('About this application'); // Response for the /about route
});

// Set the server to listen on a specific port
const PORT = process.env.PORT || 3000; // Use PORT from environment or default to 3000
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`); // Log the server URL
});

0 comments on commit e8e6be1

Please sign in to comment.