static: удаление сервера для публикации в pages

This commit is contained in:
tore 2026-09-22 17:21:26 +00:00
parent ab84a56876
commit e1148ad9a5
5 changed files with 0 additions and 56 deletions

View File

@ -1,4 +0,0 @@
--- run Tue Sep 22 04:51:46 PM UTC 2026 :: npm start --silent
up to date in 430ms
Server running on port 3000

View File

@ -1 +0,0 @@
86

12
package-lock.json generated
View File

@ -1,12 +0,0 @@
{
"name": "sverka-dokumentov-pri-naznac",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sverka-dokumentov-pri-naznac",
"version": "1.0.0"
}
}
}

View File

@ -1,8 +0,0 @@
{
"name": "sverka-dokumentov-pri-naznac",
"version": "1.0.0",
"main": "server.js",
"scripts": {
"start": "node server.js"
}
}

View File

@ -1,31 +0,0 @@
const http = require('http');
const fs = require('fs');
const path = require('path');
const PORT = process.env.PORT || 3000;
const server = http.createServer((req, res) => {
let filePath = req.url.split('?')[0];
if (filePath === '/') filePath = '/index.html';
const safePath = path.join(__dirname, filePath);
if (!safePath.startsWith(__dirname)) {
res.writeHead(403);
return res.end('Forbidden');
}
fs.readFile(safePath, (err, data) => {
if (err) {
res.writeHead(404);
return res.end('Not Found');
}
const ext = path.extname(safePath);
const contentType = ext === '.css' ? 'text/css' : ext === '.js' ? 'application/javascript' : 'text/html';
res.writeHead(200, { 'Content-Type': contentType });
res.end(data);
});
});
server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});