Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day6 #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
10 changes: 9 additions & 1 deletion app/public/zadanie01/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
<!-- Twój kod -->
<html>
<body>
<form action="/sum" method="post">
Liczba a: <input type="text" name="a"><br>
Liczba b: <input type="text" name="b"><br>
<button type="submit">Wyślij</button>
</form>
</body>
</html>
9 changes: 8 additions & 1 deletion app/public/zadanie02/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
<!-- Twój kod -->
<html>
<body>
<form action="/cookie/set" method="post">
Imie: <input type="text" name="imie"><br>
<button type="submit">Wyślij</button>
</form>
</body>
</html>
8 changes: 8 additions & 0 deletions app/public/zadanieDnia/add.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<body>
<form action="/save" method="post">
<textarea type="text" name="content"></textarea> <br>
<button type="submit">Wyślij</button>
</form>
</body>
</html><!-- Twój kod -->
1 change: 0 additions & 1 deletion app/public/zadanieDnia/index.html

This file was deleted.

23 changes: 22 additions & 1 deletion app/zadanie01.js
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
//Twój kod
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');
});