Backend Question : Observables


#1

Hi,

I am new to NativeScript and learning it my own. I followed the official documentation etc and did some work. I am stuck at a point - here you go.

I am quite experienced PHP/Backend/Database application developer. I already have a big database, and I want my NEW IOS to be connect to that database.

I need some tutorial/document etc that can give me some hint how I can code a PHP script to serve data to my IOS APP users. I do not know how to return the data for Observable.

Please guide !
Regards
ZH


#2

Why do you insist on a PHP script?

How about making http requests to your backend, which will return information in a JSON, which you can then use as Observable on the NativeScript end?


#3

Thank you Pete.

Well, why PHP ? Actually all my current website/database etc all done in PHP, so I can code a PHP script that will get the request from IOS App and fetch the data etc.

JSON okay, so you mean that my script should get the request and then response with the JSON and that will work ?

What about if I just want to authenticate a user ? and the HTTP Request will only respond in TRUE or FALSE ? True = let the user login and FALSE = authentication failed ?


#4

I don’t see why you wouldn’t be able to accomplish that. The NativeScript cross-platform modules provide basic http implementation through which you can make requests to your server, and do as you wish with the responses. https://docs.nativescript.org/cookbook/http


#5

Thank you - yes that works like a charm !