I am trying to send HTTP GET
request with email
in params
in following code:
$http.get('api/me', {
params: {
email: email
}
});
but at backend I am receiving empty params i.e. request.params
is blank. I tried the other format of HTTP
request i.e.
$http({
url: 'api/me',
method: "GET",
params: {email: email}
});
but result is same i.e. empty params at backend.
My backend code:
User.findOne({ email: request.params.email }, function(error, user) {
if (error) {
throw error;
} else if (!user) {
response.json({
message: "User doesn't exist.",
status: 0
});
} else {
response.json({
message: "Successfully logged in.",
status: 1,
data: user
});
}
});