Powtórzenie z lekcji 1
This commit is contained in:
1 parent
a102c6ea1e
commit
0d1dce5535
625 files changed
+65007
No files matched your search
@@ -0,0 +1,17 @@
|
||||
const express = require("express")
|
||||
const app = express()
|
||||
const PORT = 3000
|
||||
|
||||
app.get("/user/:id", function(req, res) { // po dwukropku informacje są traktowane jako parametr pomimo że "są ścieżką"
|
||||
let id = req.params.id
|
||||
if(id == 2) {
|
||||
res.send("Odsyłam stronę usera z id = 2")
|
||||
} else {
|
||||
res.send(`Jakieś dziwne to id... ${id}?!`)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
app.listen(PORT, function() {
|
||||
console.log("Serwer uruchomiony, port " + PORT)
|
||||
})
|
||||
Reference in new issue
Block a user