/
githubmirror
/
Awesome-Design-Tools
Обзор
Документация
Войти
/
githubmirror
/
Awesome-Design-Tools
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/server.js
15 строк
385 B
Vladimir Berezovsky
change port
18 апр 2019, 18:23
Не верифицирован
18 апр 2019, 18:23
be6992d
Код
Авторство
О чём код?
const http = require('http'); const path = require('path'); const fs = require('fs'); http.createServer((req, res) => { page(req, res, 'index'); }).listen(8001, '127.0.0.1'); function page(req, res, name) { fs.readFile(name + '.html', function (err, data) { res.writeHead(200, {'Content-Type': 'text/html', 'Content-Length': data.length}); res.write(data); res.end(); }); }