This commit is contained in:
MishaBagger
2023-10-25 09:15:21 +03:00
commit b6c10cc93f
9828 changed files with 1446743 additions and 0 deletions

18
14/app.js Normal file
View File

@@ -0,0 +1,18 @@
const http = require('http');
const fs = require('fs');
http.createServer(function (request, response) {
console.log(`Запрошенный адрес: ${request.url}`);
// получаем путь после слешаW
const filePath = request.url.substr(1);
fs.readFile(filePath, function (error, data) {
if (error) {
response.statusCode = 404;
response.end('Resourse not found!');
} else {
response.end(data);
}
});W
}).listen(3000, function () {
console.log('Server started at 3000');
});