Files
serwerowe_stefanczyk/Lekcja_01/server05.js
T
2026-09-09 19:31:31 +02:00

18 lines
460 B
JavaScript

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)
})