Page 1 of 1

Own REST-service to local database

Posted: Tue Apr 08, 2014 6:02 pm
by Nick Scheynen

Ok I'm new to appery, but I have worked with phonegap before. I have my own API on my own server and I can successfully load the data and display a list of products in my app.
I know and understand the code to store something in a local database, but I'm having trouble with the link between both.

I tried to map the response to a custom javascript, but I can't drop the '$'-sign on the custom javascript.

What's the right way to work here?


Own REST-service to local database

Posted: Tue Apr 08, 2014 6:48 pm
by Kateryna Grynko

Hi Nick,

Do you want to process a service response using JavaScript?


Own REST-service to local database

Posted: Tue Apr 08, 2014 7:08 pm
by Nick Scheynen

I want my user to be able to download our catalogue, so that it is also available offline. So for example the user goes to a download page and presses a button to download all the products from a certain category. On this click event I want the app to get the products from the server (I have made a service for that) and save them in the local database.
On another page the user can see the available categories and on click the app will then show the products from the local database.


Own REST-service to local database

Posted: Tue Apr 08, 2014 8:09 pm
by Kateryna Grynko

Nick,

Then you can add service Success event handler. Service response is stored in variable 'data' - so use it as you need.


Own REST-service to local database

Posted: Wed Apr 09, 2014 8:00 am
by Nick Scheynen

Ok perfect, got it working and the data is in the local database! Can I get it from the local database using a service? Then I would be able to easily map it to the GUI?


Own REST-service to local database

Posted: Wed Apr 09, 2014 1:18 pm
by Maryna Brodina

Hello!

Yes, please take a look here http://docs.appery.io/documentation/r...