Initial Commit

This commit is contained in:
AG
2025-12-20 23:15:29 +02:00
commit 68be2c81b0
7 changed files with 2683 additions and 0 deletions

34
server.js Normal file
View File

@@ -0,0 +1,34 @@
const express = require('express');
const path = require('path');
const http = require('http'); // Changed from https to http
const app = express();
const port = 3000; // This is the port your container listens on internally
// --- SSL/TLS Certificate code removed ---
// Nginx Proxy Manager handles HTTPS, so the app only needs to listen for HTTP.
// Serve static files from the current directory (which is /usr/src/app due to volume mapping)
app.use(express.static(path.join(__dirname)));
// Route for the root URL, serving index.html
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'), (err) => {
if (err) {
console.error('Error sending index.html:', err);
res.status(404).send('File not found or other server error.');
}
});
});
// Create an HTTP server using the Express app
const httpServer = http.createServer(app);
// Start the HTTP server on the internal container port (3000)
httpServer.listen(port, () => {
console.log(`HTTP Server running on port ${port} inside the container.`);
console.log(`Access this via Nginx Proxy Manager at https://apps.aglink.duckdns.org/`);
});
// Optional: Implement a handler to trust proxies (like Nginx)
// to correctly identify the client IP, though often not strictly necessary for simple routing.
// app.set('trust proxy', 1);