This commit is contained in:
Volodya
2023-10-25 11:51:44 +03:00
parent 4b192915ed
commit ada5fc2e11
54 changed files with 1178 additions and 7 deletions

19
app.js
View File

@@ -1,9 +1,16 @@
const http = require('http');
const fs = require('fs');
let message = 'Hello World!';
http.createServer(function (request, response) {
console.log(message);
response.end(message);
}).listen(3000, '127.0.0.1', () => {
console.log('Сервер начал прослушивание запросов');
});
fs.readFile('index.html', 'utf8', function (
error,
data
) {
let message = 'Изучаем Node.js';
let header = 'Главная страница';
data = data
.replace('{header}', header)
.replace('{message}', message);
response.end(data);
});
}).listen(3000);