From f62f01493ab74e7f3d81454510d0e2d4f3a62c2c Mon Sep 17 00:00:00 2001 From: numex-admin Date: Wed, 9 Sep 2026 22:40:13 +0000 Subject: [PATCH] =?UTF-8?q?Numex=20yay=C4=B1n:=20server.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 server.js diff --git a/server.js b/server.js new file mode 100644 index 0000000..b277e38 --- /dev/null +++ b/server.js @@ -0,0 +1,26 @@ +// İnsan Dolaşım & Sinir Sistemi Simülasyonu — statik sunucu +// public/ klasöründeki canvas uygulamasını servis eder. +// Port: işletim sistemi otomatik boş port atar (EADDRINUSE imkânsız). +const express = require('express'); +const path = require('path'); + +const app = express(); + +// Statik dosyalar (index.html, app.js, style.css) +app.use(express.static(path.join(__dirname, 'public'))); + +// Health check — sunucunun ayakta olduğunu doğrulamak için +app.get('/api/health', (req, res) => { + res.json({ durum: 'ok', zaman: new Date().toISOString() }); +}); + +// Ana sayfa +app.get('/', (req, res) => { + res.sendFile(path.join(__dirname, 'public', 'index.html')); +}); + +// 0 = boş bir port ver — gerçek portu address().port'tan al +const server = app.listen(0, () => { + const port = server.address().port; + console.log(`♥ Kalp & Dolaşım Simülasyonu http://localhost:${port}`); +});