deployed test app from node.js samples

This commit is contained in:
2026-06-20 14:00:36 +03:00
commit 1f23e2c2e0
2 changed files with 26 additions and 0 deletions

25
index.js Normal file
View File

@@ -0,0 +1,25 @@
import http from "http";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const server = http.createServer((req, res) => {
const filePath = path.join(__dirname, "message.txt");
fs.readFile(filePath, "utf8", (err, data) => {
if (err) {
res.writeHead(500, { "Content-Type": "text/plain" });
res.end("Error reading file");
} else {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end(data);
}
});
});
server.listen(3000, () => {
console.log("Server is running on port 3000");
});

1
message.txt Normal file
View File

@@ -0,0 +1 @@
Testing node.js app deployed via platform