From b7bb645f7c7a432f2fe654e15fe87c8bb7d529bf Mon Sep 17 00:00:00 2001 From: numex-admin Date: Wed, 9 Sep 2026 22:39:34 +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 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server.js diff --git a/server.js b/server.js new file mode 100644 index 0000000..26b9136 --- /dev/null +++ b/server.js @@ -0,0 +1,25 @@ +/* + * raycaster-3d — statik dosya sunucusu (Express) + * ============================================== + * Saf 2D canvas raycasting motorunu tarayiciya sunar. + * Bagimlilik: express (npm install) + */ +const path = require('path'); +const express = require('express'); + +const PORT = process.env.PORT || 4173; +const app = express(); + +// /public ve kok icerisindeki static dosyalar (index.html, curl olmasin diye kokte de durur) +app.use(express.static(path.join(__dirname, 'public'))); +// Kokten de acilabilsin (index.html kokte ise) +app.use(express.static(__dirname)); + +// Tum bilinmeyen istekleri index'e yonlendir +app.get('*', (req, res) => { + res.sendFile(path.join(__dirname, 'public', 'index.html')); +}); + +app.listen(PORT, () => { + console.log(`[raycaster-3d] Sunucu ayakta -> http://localhost:${PORT}`); +});