Hey, how would i be able to get the results from a basic html to the server, so i could save it in mongoose for example or send it with a webhook.
Misly
edit: im using express
Hey, how would i be able to get the results from a basic html to the server, so i could save it in mongoose for example or send it with a webhook.
Misly
edit: im using express
From what i know you don’t need a parser middleware anymore as its included in express now.
Nice examples here (scroll down for the normal form format instead of json)
app.use(express.urlencoded())
app.post('/formpage', (req, res) => {
console.log(req.body)
})
Not tested- should work
@anon43649539
Don’t know why the examples you linked are so confusing for such a simple task
and what should the action on the form be as i cant get it working?
<form action="/formpage" method="post">
<input type="text" name="name" placeholder="Name"></input>
</form>
Any errors? If so, send them here
seems to work but how would i redirect the user back after they complete the form?
app.use(express.urlencoded())
app.post('/formpage', (req, res) => {
console.log(req.body);
res.redirect("/formpage");
})
Thank you (:
…