-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e1f5f6
commit e8e6be1
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); |