Загрузить файлы в «/»

This commit is contained in:
2026-05-01 12:54:43 +05:00
commit 6bb93634c0
2 changed files with 21 additions and 0 deletions

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"express": "^5.2.1"
}
}

16
server.js Normal file
View File

@@ -0,0 +1,16 @@
const express = require('express');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 3000;
// Раздача статических файлов из папки public
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.listen(PORT, () => {
console.log(`Сервер Hotel 777 запущен: http://localhost:${PORT}`);
});