1

How can I read a json post, I have a react native app that is posting to my perl api, I'm doing what is below, but the post is alway empty, then I realize that what is being posted is a json post but I dont' know how to read the values from the post.

my $query    = new CGI;
my $email    = $query->param("email");
my $password = $query->param('password');

This is my post from react

axios.post(url, {
    email: 'myemail@email.com',
    password: 'password'
    })
    .then(function (response) {
    alert(response);
    })
    .catch(function (error) {
    alert(error);
});
Pedro
  • 1,440
  • 2
  • 15
  • 36
  • Once you've got the POSTDATA (see linked duplicate) you can use the [JSON module](https://metacpan.org/pod/distribution/JSON/lib/JSON.pm) to turn that into Perl data. See for example https://stackoverflow.com/q/25950359/1331451. – simbabque Jun 03 '21 at 17:55

0 Answers0