From 99d7c32bafb5c3e345f364503e496daf024aa6cb Mon Sep 17 00:00:00 2001 From: RadekM86 Date: Thu, 1 Feb 2018 19:25:54 +0100 Subject: [PATCH 1/3] zadanie Dnia 1 --- app/zadanieDnia1.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 From 1f5528d9988f235232e7cbd55450aa84a9b83d76 Mon Sep 17 00:00:00 2001 From: RadekM86 Date: Thu, 1 Feb 2018 19:31:44 +0100 Subject: [PATCH 2/3] Zadanie Dnia 2 --- app/zadanieDnia2.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/zadanieDnia2.js b/app/zadanieDnia2.js index 8c20173..65bd0fa 100644 --- a/app/zadanieDnia2.js +++ b/app/zadanieDnia2.js @@ -1 +1,18 @@ -//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']; + console.log('Preferowane języki:', acceptLanguage); + 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 From ee1895a22c7dbaa4f32a9e25e69bb5cea9742254 Mon Sep 17 00:00:00 2001 From: RadekM86 Date: Thu, 1 Feb 2018 19:38:21 +0100 Subject: [PATCH 3/3] Poprawki w zad 2 --- app/zadanieDnia2.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/zadanieDnia2.js b/app/zadanieDnia2.js index 65bd0fa..f123a84 100644 --- a/app/zadanieDnia2.js +++ b/app/zadanieDnia2.js @@ -4,12 +4,11 @@ const http = require('http'); const srv = http.createServer((req, res) => { const acceptLanguage = req.headers['accept-language']; const userAgent = req.headers['user-agent']; - console.log('Preferowane języki:', acceptLanguage); res.setHeader("Content-Type", "text/html; charset=utf-8"); - res.end(`

Hello, World from back-end!"

+ res.end(`

Hello, World from back-end!

- +
Preferowane językiPrzeglądarka
${acceptLanguage}${userAgent}
${acceptLanguage}${userAgent}
`) });