Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
*.*~
node_modules
9 changes: 9 additions & 0 deletions app/testowySerwer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const http = require('http');

const srv = http.createServer((req, res) => {
console.log('Ktoś puka do drzwi back-endu!');
});

srv.listen(3000, () => {
console.log('Serwer uruchomiony na porcie 3000');
});
17 changes: 16 additions & 1 deletion app/zadanieDnia1.js
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
//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'];
const accept = req.headers['accept'];
console.log('Preferowane języki:', acceptLanguage,
'\n info o systemie i przeglądarce użytkownika: ', userAgent,
'\n Treści preferowane przez przeglądarkę: ', accept);
res.setHeader("Content-Type", "text/html; charset=utf-8");
res.end('<html><body><h1>Hello, World from back-end!</h1></body></html>');
});

srv.listen(3000, () => {
console.log('Serwer uruchomiony na porcie 3000');
});
13 changes: 12 additions & 1 deletion app/zadanieDnia2.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
//Twój kod
const http = require('http');

const srv = http.createServer((req, res) => {
const userAgent = req.headers['user-agent'];
const accept = req.headers['accept'];
res.setHeader("Content-Type", "text/html; charset=utf-8");
res.end('<h1>Cześć przeglądarko!</h1>'+ '<p>Oto trochę informacji o Tobie: </p>' + userAgent + '<p>To są treści, jakie preferujesz: </p>' + accept);
});

srv.listen(3000, () => {
console.log('Serwer uruchomiony na porcie 3000');
});