I have a CouchDB database, and a nodeJS with express to make an API using couchdb-promises library.
In ionic 2 provider I do:
login(credentials) {
let params = {
username: credentials.email.toLowerCase(),
password: SHA3(credentials.password).toString()
};
return new Promise((resolve, reject) => {
this.http.post(API + '/auth/login', params)
.map(res => res.json())
.subscribe(data => {
localStorage.setItem('user', JSON.stringify(data.user));
resolve(true);
});
},
error => {
reject(Error(error._body));
});
});
}
It works fine the first time , but if I logout and try again, request hangs server and does not work. I need to restart server app in order to login again.
If I request via curl, I can post as many times as I want, but if I first login in Ionic 2 app, and then I send a curl request, I have not response either.
I first thougth it is problem in server side (and I tried other versions of nodejs), but only happens if I do the Ionic Http.post. Other request also hangs server, not only login. Seems only can be done one request at all.
What could be happening? Should I finalize the requests in any way?
Cordova CLI: 6.3.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
OS: Linux 4.4
Node Version: v7.8.0
express: 4.15.2
couchdb-promises: 3.0.0
The problem is not Ionic 2 itself, using in server nano instead of couchdb-promises works fine.
Still having no idea why couchdb-promises hangs with Ionic and does not with normal request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.