Files
serwerowe_stefanczyk/Powtorka_01/server01.js
T
2026-09-30 17:28:53 +02:00

28 lines
527 B
JavaScript

const express = require('express')
const app = express()
const PORT = 3000
const path = require('path')
app.use(express.json())
app.use(express.urlencoded({
extended: true
}));
app.get("/", function(req, res) {
res.sendFile(path.join(__dirname, "/static/index1.html"))
})
app.post("/test", function(req, res) {
console.log(req.body)
res.send(JSON.stringify({ odpowiedz: "no siema" }))
})
app.use(express.static('static'))
app.listen(PORT, function() {
console.log("Serwer działa, port " + PORT)
})