Numex yayın: server.js

This commit is contained in:
numex-admin 2026-09-09 22:39:34 +00:00
parent 07d51f1f22
commit b7bb645f7c

25
server.js Normal file
View File

@ -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}`);
});