This tutorial will show you how to add a database to your mobile app. Appery.io integrated backend services include a cloud database, push notifications, and server code.
- Sign up for Appery.io Starter (free) plan
- Create a new app by entering its name and clicking the Create button:
- Build the app UI:
- The UI is very simple, there is just the List component (items reduced from 3 to 1 as we will be loading the items from a cloud database)
- To add a cloud database to the app, click Backend Services (upper right corner):
- On the Database page, enter a new database name and click Create button:
- Open Collections tab
- Click New to add a new collection.
- Enter Customers for collection name, click Add button.
- Once a collection has been created, click +col to add a new column. Enter name for column name (type String).
- Click +Row to add sample data. For example:
- Back inside the builder, select Create New > Database Services
- From the drop down list, select the database (created in step #5)
- Expand Customers collection
- Check List services to generate. The List service will allow us to display all customers on a page.
- Click Import selected services button. Under Services folder, the REST service to access the collection has been generated:
- Open MyDatabase_Customer_list_service service, open Test tab. Click Test. You should see the customers from the database.
- Open startScreen page, switch to Data view
- Select Service > MyDatabase_Customer_list_service > Add. The service has been added to the page.
- Open Edit Mapping button
- We don’t need to map anything for service’s input. Switch to Response tab. Set the following mapping:
- Go back to Design view
- Open Events tab
- Select startScreen (for Component) > Page show (Event) > Invoke service (Action) > restservice1. Click Add Event.
- Click Test button to launch the app in the browser
That’s it. You just added a cloud database to your app. As part of Appery.io backend services, you get a cloud database, push notifications, and server code
Leave a Reply