#!/usr/bin/env node
// CloudLinux Node.js Selector specific format
// This follows the exact pattern CloudLinux expects

const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end(`
    <!DOCTYPE html>
    <html>
    <head><title>CloudLinux Test</title></head>
    <body style="padding: 40px; font-family: Arial;">
      <h1 style="color: green;">SUCCESS - CloudLinux Node.js Working!</h1>
      <p>Node version: ${process.version}</p>
      <p>PID: ${process.pid}</p>
      <p>CWD: ${process.cwd()}</p>
      <p>If you see this, Node.js is working!</p>
    </body>
    </html>
  `);
});

// Listen on Passenger port or default
const port = process.env.PORT || 3000;
server.listen(port, () => {
  console.log('Server started on port ' + port);
});
