diff --git a/app/zadanieDnia1.js b/app/zadanieDnia1.js index 8c20173..b8d18a8 100644 --- a/app/zadanieDnia1.js +++ b/app/zadanieDnia1.js @@ -1 +1,12 @@ -//Twój kod \ No newline at end of file +const http = require('http'); + +const srv = http.createServer((req, res) => { + const acceptLanguage = req.headers['accept-language']; + console.log('Preferowane języki:', acceptLanguage); + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.end('

Hello, World from back-end!"

') +}); + +srv.listen(3000, () => { + console.log('Serwer uruchomiony na porcie 3000'); +}); \ No newline at end of file diff --git a/app/zadanieDnia2.js b/app/zadanieDnia2.js index 8c20173..f123a84 100644 --- a/app/zadanieDnia2.js +++ b/app/zadanieDnia2.js @@ -1 +1,17 @@ -//Twój kod \ No newline at end of file +//Twój kod +const http = require('http'); + +const srv = http.createServer((req, res) => { + const acceptLanguage = req.headers['accept-language']; + const userAgent = req.headers['user-agent']; + res.setHeader("Content-Type", "text/html; charset=utf-8"); + res.end(`

Hello, World from back-end!

+ + + +
Preferowane językiPrzeglądarka
${acceptLanguage}${userAgent}
`) +}); + +srv.listen(3000, () => { + console.log('Serwer uruchomiony na porcie 3000'); +}); \ No newline at end of file