when iam calling angular2 http get(or)post to my nodejs application not working no error in console
login(model)
{
debugger
let options = new RequestOptions({
headers: new Headers({ 'Content-Type': 'application/json;charset=UTF-8' })
});
// var AppURL='https://staging.medicscloud.com/Dev/MedicsCloud/Mobile/MobileAuthentication/Login/?practiceID='+model.prccode;
return this.http.get('http://localhost:4006/api/user/login', model)
.map((response: Response) => {
// login successful if there's a jwt token in the response
let user = response.json();
if (user && user.token) {
// store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user));
}
}).subscribe();
//.subscribe();
}
my nodejs code
router.get('/user/login/', function (req, res) {
console.log("hiiiiiiiiii "+req.body,req.query)
// common.testapi().then(function (rows) {
// if (rows) {
// res.end("");
// }
// }).fail(function (err) {
// console.error("displayreport..." + err.body);
// });
res.end("hiiiiiii");
});
via Parsharamulu A
No comments:
Post a Comment