Keep req.body parameters when changing routes

1

Hello, my question is the following:

I'm using Express / bodyParser and Nunjucks. I submitted a form with method POST from my Root route '/'.

In form I have two data:

  • Username
  • Date of birth

In the post that I submit the form I can do a check, for example, how old is the user. If it is larger then I redirect to a route X if it is a minor I redirect to Y.

My question is exactly this route X and Y. How do I get the name that the user submitted in this request for a new route?

I'm using redirect to send it to X or Y.

    
asked by anonymous 26.07.2018 / 01:08

1 answer

0

You can review the parameters as follows:

res.redirect('/nova_rota?nome=${nome}&data=${data}');

There are other ways, just read the redirect documentation

    
26.07.2018 / 01:42