M
M
memento2021-10-20 13:40:09
Node.js
memento, 2021-10-20 13:40:09

How to get parameter from get in post node.js?

Good afternoon, the question is probably stupid, but I can’t solve it myself and I don’t have anyone to ask.

The bottom line is, there are two html forms, the first one adds general user information (first name, last name, etc.) and assigns a unique uuid there.

The second form is the page for adding user contacts (phone, insta, telegram, etc.)

uuid is passed to the url and I can get it via get:

router.get('/:uuid', async (req, res) => {
const uuid = req.body.uuid
console.log(uuid)
res.render('add_contacts ')

})

but in post I can't, I get undefined

router.post('/', async (req, res) => {
const { phone, tg, instagram, vk, uuid} = req.body
console.log ( uid)

Displays everything except uuid, it is not defined

Please tell me how to get it and in which direction to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SAPER0V, 2021-10-20
@SAPER0V

router.post('/api', function(req, res){
const { phone, tg, instagram, vk, uuid } = req.quire;
console.log(uuid);
});
Try this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question