From 2b2d69e4e431b506c54869b1363abc28c0e69a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bu=C5=82ka?= Date: Tue, 6 Feb 2018 19:44:07 +0000 Subject: [PATCH] Day6 --- app/public/zadanie01/index.html | 10 +++++++++- app/public/zadanie02/index.html | 9 ++++++++- app/public/zadanieDnia/add.html | 8 ++++++++ app/public/zadanieDnia/index.html | 1 - app/zadanie01.js | 23 ++++++++++++++++++++++- 5 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 app/public/zadanieDnia/add.html delete mode 100644 app/public/zadanieDnia/index.html diff --git a/app/public/zadanie01/index.html b/app/public/zadanie01/index.html index c116dfd..f3ce606 100644 --- a/app/public/zadanie01/index.html +++ b/app/public/zadanie01/index.html @@ -1 +1,9 @@ - \ No newline at end of file + + +
+ Liczba a:
+ Liczba b:
+ +
+ + \ No newline at end of file diff --git a/app/public/zadanie02/index.html b/app/public/zadanie02/index.html index c116dfd..9b2b173 100644 --- a/app/public/zadanie02/index.html +++ b/app/public/zadanie02/index.html @@ -1 +1,8 @@ - \ No newline at end of file + + +
+ Imie:
+ +
+ + \ 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..9913d01 --- /dev/null +++ b/app/public/zadanieDnia/add.html @@ -0,0 +1,8 @@ + + +
+
+ +
+ + \ 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..10a3066 100644 --- a/app/zadanie01.js +++ b/app/zadanie01.js @@ -1 +1,22 @@ -//Twój kod \ No newline at end of file +const express = require('express'); +const bodyParser = require('body-parser'); +const app = express(); +app.use(bodyParser.urlencoded()); + + +app.use(express.static('./public/zadanie01/')); + +app.post('/sum', (req, res) => { + const {a, b} = req.body; + + if (!(parseInt(a) % parseInt(b))){ + res.send('Liczba B jest dzielnikiem liczby A.') + } else { + res.send('Liczba B nie jest dzielnikiem liczby A.'); + } +}); + + +app.listen(3000, () => { + console.log('Wystartowalem serwerek na porcie 3000'); +}); \ No newline at end of file