ArkanoidTG/WebApp/server.js

24 lines
661 B
JavaScript
Raw Permalink Normal View History

2024-11-25 23:14:57 +03:00
const express = require('express');
const path = require('path');
const app = express();
// Telegram Mini App configuration
app.use((req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
next();
});
// Serve static files from the WebGL build directory
app.use(express.static(path.join(__dirname, 'webgl-build')));
// Serve the Mini App HTML wrapper
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});