commit 521d86e50d9b3abdee9dd4b6de77cf7a5488fc53 Author: Shautvast Date: Thu Mar 19 09:50:54 2026 +0100 Add Hello World test application for Hostityourself Includes a Node.js HTTP server, static HTML page, and Dockerfile for containerized self-hosting. Exposes a /health endpoint for platform health checks. Co-Authored-By: Claude Sonnet 4.6 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..544f1d0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:20-alpine +WORKDIR /app +COPY package.json . +COPY server.js . +COPY index.html . +EXPOSE 3000 +CMD ["node", "server.js"] diff --git a/index.html b/index.html new file mode 100644 index 0000000..912bedd --- /dev/null +++ b/index.html @@ -0,0 +1,34 @@ + + + + + + Hello World + + + +
+

Hello, World!

+

Test application for Hostityourself

+
+ + diff --git a/package.json b/package.json new file mode 100644 index 0000000..baa669a --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "helloworld", + "version": "1.0.0", + "description": "Hello World test app for Hostityourself", + "main": "server.js", + "scripts": { + "start": "node server.js" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..fb59a40 --- /dev/null +++ b/server.js @@ -0,0 +1,30 @@ +const http = require('http'); +const fs = require('fs'); +const path = require('path'); + +const PORT = process.env.PORT || 3000; + +const server = http.createServer((req, res) => { + if (req.url === '/' || req.url === '/index.html') { + const filePath = path.join(__dirname, 'index.html'); + fs.readFile(filePath, (err, data) => { + if (err) { + res.writeHead(500); + res.end('Error loading page'); + return; + } + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(data); + }); + } else if (req.url === '/health') { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ status: 'ok' })); + } else { + res.writeHead(404); + res.end('Not found'); + } +}); + +server.listen(PORT, () => { + console.log(`Server running on http://localhost:${PORT}`); +});