commit 1f23e2c2e0859e4b966e141804d947aa62933c6c Author: crybabbby Date: Sat Jun 20 14:00:36 2026 +0300 deployed test app from node.js samples diff --git a/index.js b/index.js new file mode 100644 index 0000000..ccc1fdb --- /dev/null +++ b/index.js @@ -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"); +}); diff --git a/message.txt b/message.txt new file mode 100644 index 0000000..741d15b --- /dev/null +++ b/message.txt @@ -0,0 +1 @@ +Testing node.js app deployed via platform