proper Fetch request for sign in without webToken Auth

Viewed 15

so I configured backend with express, mongoose, and MongoDB. On client side in react I have signIn form with fields: email and password. I want to send this object to server, and make server search database for object with those values for the keys. on server request is:

router.get('/SignIn', getUser);

where getUser is

const getUser = async (req, res) => {
      const user = await User
        .findOne({ userPassword, userEmail })
        .exec();
      
      res.status(200).json(user);
};

Question is: on the client side what request shall I use? I want to pass object, but I don't want to add it to database, so POST request doesn't seem right. GET request cant have body. I don't want to store password and email in req.params.password or req.params.email. Will be glad for advice.

0 Answers
Related