From 10cb7517549bb1d26ad46a91dc5cdcac8a3a80ce Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Thu, 20 Nov 2025 09:52:57 +0000 Subject: [PATCH 1/7] forked --- package-lock.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 61b5dcb84..3b7b577d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,13 @@ { - "name": "papa-node-hello-000", + "name": "node-hello", "version": "1.0.0", - "lockfileVersion": 1 + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "node-hello", + "version": "1.0.0", + "license": "ISC" + } + } } From 7d6854ad7e56d6a75d8c1a08c6e941b411e7d483 Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:11:03 +0000 Subject: [PATCH 2/7] new code added --- index.html | 35 +++++++++++++++++++++++++++++++++++ index.js | 19 +++++++++++++++---- 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 000000000..451fb3e91 --- /dev/null +++ b/index.html @@ -0,0 +1,35 @@ + + + + My Simple Node Page + + + +
+

Hello from Node.js!

+

This webpage is served from a separate index.html file.

+
+ + diff --git a/index.js b/index.js index 54e5fef1f..cf047ec52 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,23 @@ const http = require('http'); +const fs = require('fs'); +const path = require('path'); + const port = process.env.PORT || 3000; const server = http.createServer((req, res) => { - res.statusCode = 200; - const msg = 'Hello Node!\n' - res.end(msg); + const filePath = path.join(__dirname, 'index.html'); + + fs.readFile(filePath, (err, content) => { + if (err) { + res.writeHead(500); + res.end('Error loading file'); + } else { + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(content); + } + }); }); server.listen(port, () => { - console.log(`Server running on http://localhost:${port}/`); + console.log(`Server running at http://localhost:${port}`); }); From 91078d4233ce92519be81016b92b4d209ac7ac67 Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Fri, 21 Nov 2025 09:32:13 +0000 Subject: [PATCH 3/7] added jenkins file --- Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..052aa5775 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,35 @@ +pipeline { + agent any + + tools { + nodejs 'nodejs' + } + + stages { + + stage('Checkout Code') { + steps { + git branch: 'master', url: 'https://github.com/harshrajurkar/node-hello.git' + } + } + + stage('Upload index.html to S3') { + steps { + withAWS(region: 'ap-south-1', credentials: 'aws-creds') { + s3Upload bucket: 'my-frontend-site-node', + file: 'index.html', + path: "index.html" + } + } + } + } + + post { + success { + echo "index.html uploaded to S3 successfully!" + } + failure { + echo "Upload failed!" + } + } +} diff --git a/index.html b/index.html index 451fb3e91..fbcbac0c0 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@
-

Hello from Node.js!

+

sucessfull deployemnt!

This webpage is served from a separate index.html file.

From 439c9f659855d6057325280dc94367a48b80d370 Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:06:52 +0000 Subject: [PATCH 4/7] chnaged into index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index fbcbac0c0..665d3b65d 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@

sucessfull deployemnt!

-

This webpage is served from a separate index.html file.

+

This webpage is served from a separate index.html file for s3.

From 6b06c9b18e50f48d72f43c1103949073b89d44cb Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:08:17 +0000 Subject: [PATCH 5/7] chnged in jenkins file --- Jenkinsfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 052aa5775..68aba6229 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,6 @@ pipeline { agent any - tools { - nodejs 'nodejs' - } - stages { stage('Checkout Code') { @@ -32,4 +28,4 @@ pipeline { echo "Upload failed!" } } -} +} \ No newline at end of file From b235f68febd1f7a35a4ef00ef0f4d4d07db93f8d Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:49:34 +0530 Subject: [PATCH 6/7] Modify paragraph text in index.html Updated the paragraph text in index.html to include additional content. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 665d3b65d..548217c6f 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@

sucessfull deployemnt!

-

This webpage is served from a separate index.html file for s3.

+

This webpage is served from a separate index.html file for s3...1..2..3..4....

From 67c9b2f5b309cc1c03bc66e488755c63bddb4e90 Mon Sep 17 00:00:00 2001 From: harshrajurkar <88499120+harshrajurkar@users.noreply.github.com> Date: Fri, 21 Nov 2025 16:14:12 +0530 Subject: [PATCH 7/7] Fix typo in deployment message --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 548217c6f..191222ce9 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@

sucessfull deployemnt!

-

This webpage is served from a separate index.html file for s3...1..2..3..4....

+

This webpage is served from a separate index.html file for s3...1..2..3..4....5