Skip to content

Commit

Permalink
Added icons path on server side
Browse files Browse the repository at this point in the history
  • Loading branch information
Amalkrishnanvp committed Aug 29, 2024
1 parent a0d2d8d commit 77fab16
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</head>

<body>
<div class="" id="my-home">
<div id="my-home">
<!-- Navbar -->
<nav class="flex text-white justify-between p-5 sm:p-7 lg:p-9 items-start lg:items-center sticky top-0 navbar">
<!-- my name heading -->
Expand Down Expand Up @@ -56,7 +56,7 @@ <h2 class="font-semibold text-3xl md:text-4xl my-name">Amal</h2>
Contact<i class="fa-solid fa-id-card ml-1 text-base"></i>
</li>
</a>
<a href="public/documents/Resume3.pdf" download="Amal_Krishnan_V_P_Resume.pdf">
<a href="public/documents/Resume3.pdf" download="AmalKrishnanVP_Resume.pdf">
<li class="pad-5 nav-border list-item">
Resume<i class="fa-solid fa-file-arrow-down download-icon ml-1 text-base"></i>
</li>
Expand Down
39 changes: 39 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,45 @@ const server = http.createServer((req, res) => {
res.end();
}
});
} else if (req.method === "GET" && pathName === "/public/icons/node.jpg") {
fs.readFile(path.join(iconsPath, "node.jpg"), (err, data) => {
if (err) {
res.writeHead(500, { "Content-Type": "text/plain" });
res.write("Error found, " + err);
res.end();
} else {
res.writeHead(200, { "Content-Type": "image/png" });
res.write(data);
res.end();
}
});
} else if (req.method === "GET" && pathName === "/public/icons/express.png") {
fs.readFile(path.join(iconsPath, "express.png"), (err, data) => {
if (err) {
res.writeHead(500, { "Content-Type": "text/plain" });
res.write("Error found, " + err);
res.end();
} else {
res.writeHead(200, { "Content-Type": "image/png" });
res.write(data);
res.end();
}
});
} else if (
req.method === "GET" &&
pathName === "/public/icons/handlebars.png"
) {
fs.readFile(path.join(iconsPath, "handlebars.png"), (err, data) => {
if (err) {
res.writeHead(500, { "Content-Type": "text/plain" });
res.write("Error found, " + err);
res.end();
} else {
res.writeHead(200, { "Content-Type": "image/png" });
res.write(data);
res.end();
}
});
} else if (req.method === "GET" && pathName === "/public/images/img1.png") {
fs.readFile(path.join(imagesPath, "img1.png"), (err, data) => {
if (err) {
Expand Down

0 comments on commit 77fab16

Please sign in to comment.