diff --git a/app/zadanieDnia1.js b/app/zadanieDnia1.js index 8c20173..f63f7a8 100644 --- a/app/zadanieDnia1.js +++ b/app/zadanieDnia1.js @@ -1 +1,14 @@ -//Twój kod \ No newline at end of file +//Twój kod + +const http = require('http'); + +const srv = http.createServer((req, res) => { + + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.end('

Hello World

'); + +}); + +srv.listen(3000, () => { + +}); \ No newline at end of file diff --git a/app/zadanieDnia2.js b/app/zadanieDnia2.js index 8c20173..1b46fb3 100644 --- a/app/zadanieDnia2.js +++ b/app/zadanieDnia2.js @@ -1 +1,11 @@ -//Twój kod \ No newline at end of file +const http = require('http'); + +const srv = http.createServer((req, res) => { + const browser = req.headers['user-agent']; + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.end('

Hello ' + browser + '

'); +}); + +srv.listen(3000, () => { +console.log("Serwer wystartowal"); +}); \ No newline at end of file