json - Register internal ionic app path as REST provider -




for reasons i'd build in-app rest endpoint in ionic 3 app. frontend components should able call data in-app backend simple http.request. i.e. so:

this.http.request("/#/api/local/getusers", requestoptions).subscribe(       (rc) => { console.log(rc.text()); },       (err) => { console.log(err) }     ); 

the result of request should json list of valid users (whatever, determined registered controller , request parameters).

i have succeeded register path component so:

@ionicpage({   name: 'api',   segment: 'local/:method', }) @component({   selector: 'page-fgttm',   templateurl: 'fgttm.html', }) export class fgttmpage ... 

and when navigate /#/api/local/getusers can see (unfortunately html) output written in fgttm.html. this.http.request("/#/api/local/getusers" recieves plain index.html template (far away json @ least 200).

what missing here? there way bind ionic-provider path (like controller in angular or drupal)?

edit: have tried use ionic-native/deeplinks. doesn't work. deeplink routes called when click on link in device browser expected. routes not called when try access them via http.request(myscheme://myurl.com/api etc. inside app.

edit2: using in-app light-httpd server (ionic-native/httpd) not option because testing in chrome wouldn't possible.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -