contact request handled in server.

This commit is contained in:
sweatshirt0 2023-02-20 16:28:30 -05:00
parent 9bfcf0ab87
commit 232bd39871
1 changed files with 15 additions and 0 deletions

View File

@ -61,6 +61,21 @@ const server = http.createServer((req, res) => {
res.end();
});
}
if (req.url === "/contact") {
res.statusCode = 200;
res.setHeader("Content-Type", "text/html");
fs.readFile("./pages/contact.html", (error, data) => {
if (error) {
res.writeHead(404);
res.write("Error: File not found.");
} else {
res.write(data);
}
res.end();
});
}
});
const port = process.env.port || 9000;