23 lines
504 B
JavaScript
23 lines
504 B
JavaScript
const express = require("express")
|
|
const app = express()
|
|
const PORT = 3000
|
|
|
|
const path = require("path")
|
|
|
|
app.use(express.urlencoded({
|
|
extended: true
|
|
}))
|
|
|
|
app.get("/", function (req, res) {
|
|
res.sendFile(path.join(__dirname, '/static/formularz_post_1.html'))
|
|
})
|
|
|
|
app.post("/handle_form", function (req, res) {
|
|
console.log(req.body)
|
|
res.send(`<html><body style="background: ${req.body.colour};">${req.body.colour}</body></html>`)
|
|
})
|
|
|
|
app.listen(PORT, function () {
|
|
console.log(PORT)
|
|
})
|