req.body
const express = require("express");
const app = express();
app.use(express.urlencoded());
app.get("/", (req, res, next) => {
res.send(`<script>
fetch("/push", {
body: "someTEXT",
headers: {
"Content-Type": "text/html; charset=UTF-8",
},
method: "POST",
}).then((data) => console.log(data));
</script>`);
});
app.post("/push", function (req, res, next) {
console.log(req.body);
res.send(req.body);
});
app.listen(3000);