Hussein2001/nodeJS
0
1const express = require('express');2const path = require('path');3 4const app = express();5const PORT = process.env.PORT || 7860;6 7// Serve static files8app.use(express.static('public'));9 10// Main route11app.get('/', (req, res) => {12 res.sendFile(path.join(__dirname, 'public', 'index.html'));13});14 15// Login route16app.get('/login', (req, res) => {17 res.sendFile(path.join(__dirname, 'public', 'login.html'));18});19 20// Register route21app.get('/register', (req, res) => {22 res.sendFile(path.join(__dirname, 'public', 'register.html'));23});24 25// Health check endpoint26app.get('/health', (req, res) => {27 res.json({ status: 'ok', message: 'Server is running' });28});29 30app.listen(PORT, '0.0.0.0', () => {31 console.log(`Server is running on port ${PORT}`);32});33 