diff --git a/app/public/zadanie01/index.html b/app/public/zadanie01/index.html
index c116dfd..727abd5 100644
--- a/app/public/zadanie01/index.html
+++ b/app/public/zadanie01/index.html
@@ -1 +1,21 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+ Coders Lab
+
+
+
+
Chcesz wiedzieć czy liczba B jest dzielnikiem liczby A?
+
+
+
\ No newline at end of file
diff --git a/app/public/zadanie02/index.html b/app/public/zadanie02/index.html
index c116dfd..494cfc4 100644
--- a/app/public/zadanie02/index.html
+++ b/app/public/zadanie02/index.html
@@ -1 +1,20 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+ Coders Lab
+
+
+
+
Jak masz na imię?
+
+
+
\ No newline at end of file
diff --git a/app/public/zadanieDnia/add.html b/app/public/zadanieDnia/add.html
new file mode 100644
index 0000000..9f797b8
--- /dev/null
+++ b/app/public/zadanieDnia/add.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+ Coders Lab
+
+
+
+
Napisz komentarz:
+
+
+
\ No newline at end of file
diff --git a/app/public/zadanieDnia/index.html b/app/public/zadanieDnia/index.html
deleted file mode 100644
index c116dfd..0000000
--- a/app/public/zadanieDnia/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/app/zadanie01.js b/app/zadanie01.js
index 8c20173..b7b5c3a 100644
--- a/app/zadanie01.js
+++ b/app/zadanie01.js
@@ -1 +1,23 @@
-//Twój kod
\ No newline at end of file
+//Twój kod
+
+const express = require('express');
+const bodyParser = require('body-parser');
+const app = express();
+app.use(bodyParser.urlencoded({ extended: false }));
+
+app.use(express.static('./public/zadanie01/'));
+
+app.post('/result', (req, res) => {
+ const {numberA, numberB} = req.body;
+ let information = '';
+ if (parseInt(numberA) % parseInt(numberB) === 0) {
+ information = `Tak! Liczba ${numberB} jest dzielnikiem liczby ${numberA}`;
+ } else {
+ information = `Nie! Liczba ${numberB} nie jest dzielnikiem liczby ${numberA}`;
+ }
+ res.send(`
${information}
`);
+});
+
+app.listen(3000, () => {
+ console.log('Serwer uruchomiony na porcie 3000');
+});
\ No newline at end of file
diff --git a/app/zadanie02.js b/app/zadanie02.js
index 8c20173..63d6a76 100644
--- a/app/zadanie02.js
+++ b/app/zadanie02.js
@@ -1 +1,31 @@
-//Twój kod
\ No newline at end of file
+//Twój kod
+
+const express = require('express');
+const cookieParser = require('cookie-parser');
+const bodyParser = require('body-parser');
+const app = express();
+app.use(cookieParser());
+app.use(bodyParser.urlencoded({ extended: false }));
+
+app.use(express.static('./public/zadanie02/'));
+
+app.post('/cookie/set', (req, res) => {
+ const {name} = req.body;
+ res.cookie('nameSaved', name, {
+ maxAge : 2592000000,
+ });
+ res.send(`Zapisano imię: ${name}`);
+});
+
+app.get('/cookie/show', (req, res) => {
+ res.send(`Zapisane imię: ${req.cookies.nameSaved}`);
+});
+
+app.get('/cookie/check', (req, res) => {
+ let information = req.cookies.nameSaved === undefined ? 'Nie zapisano imienia.' : 'Imię zapisane.';
+ res.send(information);
+});
+
+app.listen(3000, () => {
+ console.log('Serwer uruchomiony na porcie 3000');
+});
\ No newline at end of file
diff --git a/app/zadanieDnia.js b/app/zadanieDnia.js
index 8c20173..5d23ce7 100644
--- a/app/zadanieDnia.js
+++ b/app/zadanieDnia.js
@@ -1 +1,51 @@
-//Twój kod
\ No newline at end of file
+//Twój kod
+
+const express = require('express');
+const cookieParser = require('cookie-parser');
+const bodyParser = require('body-parser');
+const app = express();
+app.use(cookieParser());
+app.use(bodyParser.urlencoded({ extended: false }));
+
+app.use(express.static('./public/zadanieDnia/'));
+
+app.post('/save', (req, res) => {
+ const comments = addComment(req.cookies.commentSaved, req.body.comment)
+
+ res.cookie('commentSaved', comments, {
+ maxAge : 2592000000,
+ });
+ res.send('Zapisano komentarz Powrót do strony głównej');
+});
+
+app.get('/', (req, res) => {
+ const comments = readComments(req.cookies.commentSaved);
+ res.send(`${comments}Dodaj nowy komentarz`);
+});
+
+app.listen(3000, () => {
+ console.log('Serwer uruchomiony na porcie 3000');
+});
+
+// Funkcje pomocnicze
+
+/**
+ * Ta funkcja pobiera string dotychczasowego ciastka, dodaje nowy komentarz i zwraca nowy string - taki z jakim należy nadpisać to ciasto.
+ * @param {string} commentsCookieValue Wartość dotychczasowego ciastka przechowującego komentarze
+ * @param {string} newComment Nowy komentarz
+ * @return {string} Nowy string z komentarzami do zapisania w ciastku
+ */
+function addComment(commentsCookieValue, newComment) {
+ const comments = readComments(commentsCookieValue);
+ comments.push(newComment);
+ return JSON.stringify(comments);
+}
+
+/**
+ * Ta funkcja odczytuje już dodane komentarze i zwraca je w postaci tablicy.
+ * @param {string} commentsCookieValue Wartość dotychczasowego ciastka przechowującego komentarze
+ * @return {Array} Tablica z komentarzami
+ */
+function readComments(commentsCookieValue) {
+ return commentsCookieValue ? JSON.parse(commentsCookieValue) : [];
+}
\ No newline at end of file