BaconJuice
BaconJuice

Reputation: 3779

Can I use NativeScript to read and write from a database in app?

I want to use NativeScript to build my apps. But I'm a bit confused by what backend approach I should use.

I want to create a simple CRUD app, that writes to a DB like MySQL or postgresql. Should I a build a backend api service to carry out my CRUD operations using something like express/node stack? or should the app itself perform the CRUD operations using NativeScript?

I would like to make the NativeScript app itself perform the CRUD operations it self as I feel creating a backend service for a simple CRUD app might be overkill. But I'm not sure if NativeScript is able to perform CRUD services to a DB like MySQL for user auths etc.

Upvotes: 2

Views: 3272

Answers (1)

Nathanael
Nathanael

Reputation: 5399

Well, on most mobile phones they already have built in SQLITE database engine. Since your using NativeScript; you should checkout my NativeScript-Sqlite plugin as it contains the ability to do CRUD create/read/update/delete to/from a sqlite database on both iOS and Android platforms. If you aren't familure with Sqlite, Sqlite is used in a huge number of applications on the phone and on desktop apps like FireFox.

If you really want to use MySQL, then you will have to always have a wifi/internet connection and build some sort of a bridge via the built in HTTP module; or using something like my NativeScript-WebSockets library to talk to your back end mysql server.

However, even if you are wanting to update a MySQL database on the internet; I would recommend local database storage be in sqlite; then you sync the data when you need too.

Upvotes: 3

Related Questions