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

Uzupełnione zadania - dzień 5 #9

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
1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions app/przykladStatyczne.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/public/przykladStatyczne/css/style.css

This file was deleted.

15 changes: 0 additions & 15 deletions app/public/przykladStatyczne/index.html

This file was deleted.

14 changes: 0 additions & 14 deletions app/public/zadanieDnia/css/style.css

This file was deleted.

18 changes: 0 additions & 18 deletions app/public/zadanieDnia/index.html

This file was deleted.

15 changes: 14 additions & 1 deletion app/zadanie01.js
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
//Twój kod
const express = require('express');
const app = express();

app.get('/sum/:first/:second', (req,res) => {
const first = req.params.first;
const second = req.params.second;
const sum = parseInt(first) + parseInt(second);

res.send("Suma to:" + sum);
})

app.listen(3000,() =>{
console.log('Serwer uruchomiony na porcie 3000');
});
23 changes: 22 additions & 1 deletion app/zadanie02.js
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
//Twój kod
const express = require('express');
const app = express();
let name = '';
app.get('/name/set/:name', (req,res) =>{
name = req.params.name;
res.send('Podane imię to: '+name);
});
app.get('/name/show', (req,res) =>{
res.send('Podane imię to: '+name);
});
app.get('/name/check', (req, res) =>{
let text = '';
if(name.length>0){
text = 'To jest w Check, i imie to: '+name;
} else{
text = 'Imię nie zostało podane!';
}
res.send(text);
});
app.listen(3000, () =>{
console.log('Uruchomiono serwer na porcie 3000');
})
32 changes: 31 additions & 1 deletion app/zadanieDnia1.js
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
//Twój kod
const express = require('express');
const app = express();
let yes = 0, no = 0, maybe = 0;
const thx = 'Dziękujemy za odanie głosu!';
app.use(express.static('./public/zadanieDnia/'));

app.get('/',(req,res)=>{
console.log("Someone's at the door!");
});
app.get('/vote/:vote',(req,res) =>{
if(req.params.vote == 'yes'){
yes++;
res.send(thx);
} else if (req.params.vote == 'no') {
no++;
res.send(thx);
} else if (req.params.vote == "maybe") {
maybe++;
res.send(thx);
}
});
app.get('/votes/check',(req,res) =>{
res.send(
'Głosy na TAK: ' + yes +'<br/>'+
'Głosy na NIE: ' + no +'<br/>'+
'Głosy na MAYBE: ' + maybe
);
})
app.listen(3000, () => {
console.log('Serwer został uruchomiony na porcie 3000!');
});