EternalAI/server.js

27 lines
721 B
JavaScript

const express = require('express');
const path = require('path');
const app = express();
const PORT = 3001;
// Serve static files
app.use(express.static(__dirname));
// Basic API endpoint
app.get('/api/status', (req, res) => {
res.json({ status: 'EternalAI service is running', timestamp: new Date().toISOString(), version: '1.0.0' });
});
// Health check endpoint
app.get('/health', (req, res) => {
res.status(200).json({ status: 'healthy', timestamp: new Date().toISOString() });
});
// Catch-all handler for SPA
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`EternalAI server is running on http://0.0.0.0:${PORT}`);
});