node.js - Ionic 2 Http.post hangs nodeJS express server -
i have couchdb database, , nodejs express make api using couchdb-promises library.
in ionic 2 provider 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 first time, if logout , try again, request hangs server , not work. need restart server app in order login again.
if request via curl, can post many times want, if first login in ionic 2 app, , send curl request, have not response either.
i first thougth problem in server side (and tried other versions of nodejs), happens if ionic http.post. other request hangs server, not login. seems can done 1 request @ all.
what happening? should finalize requests in 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 not ionic 2 itself, using in server nano instead of couchdb-promises works fine.
still having no idea why couchdb-promises hangs ionic , not normal request.
Comments
Post a Comment