Which database for static content


#1

I’m an experienced developer, but I’m still fairly new to Ionic/AngularJS. I have studied almost every book and tutorial on Ionic and AngularJS in the past few months and I have successfully made example apps that connect to Firebase, Parse and to MySQL databases through an API.

Now that I’m about to make real world apps, I still have trouble figuring out where to put the content of my new apps. I understand that if I were to make a chat app, I would probably choose a provider like Firebase (noSQL), for the userdata and the comments/posts.

But what about a company app, for a company that already has a company website. And the app app would have to contain items like ‘about us’, ‘news’, ‘events’, ‘contact’, etc.

I would create an API to get the news and the events from the mysql database of the company website. But where do I store the content of an about page? And the content of a contact page?

So, I guess my two questions are:

  1. Where do I store my ‘static’ content: in Firebase? In Mysql (API)? Or can I hardcode it, and update it with Ionic Deploy?

  2. Is it a good idea to store the ‘dynamic’ content (news, events) in Firebase (after I get it from the API), so I can use offline storage?

Any help is greatly appreciated

Sybrand Hoeksma
Firmaq Media
The Netherlands


#2

Depends… static contents like about page and contact page can be hardcoded in the templates. Dynamic contents like news and events can be saved (in the app) in db (like sql) or also in local storage (you can use libraries like https://github.com/gsklee/ngStorage).


#3

Please use static data as hard code with app and dynamic data with noSQL database like MongoDB . access through api call as json format . use it.


#4

But if I hardcode the content of an about page, and my clients wants to update his about page, I would have to submit a full update to the app stores (which takes a few days with the Apple Review), right?

Is there no better solution for semi-static content?


#5

…right… so your app need, for example, to check the content of the about page to verify if was changed? every time? then the app need the network connection? how many times the about page change in a year?

A semi-static content solution can be achieved for example using something like angular-cache: https://github.com/jmdobry/angular-cache

ps. I prefer to use static data for about page and other static/semi-static contents…


#6

Would a local SQLite database do? Where you can store the page content as a text field (probably HTML) and use ng-html-bind to display this content in the pages you require.

http://ngcordova.com/docs/plugins/sqlite/

First load could populate the database with a load of INSERT statements and there could be a function in the app to compare the local version of the content with the remote copy and then update it as required.

Sorry if I’ve missed something.


#8

That sounds like a very good idea. I could cache
the remote content in SQLite and check for updates. This could work a
bit like Ionic Deploy, I guess. Too bad that Ionic Platform is still in
beta. Otherwise I could use Ionic Deploy …

Thanks for the excellent tip. I think I will give this a try.


#9

I’m very much like you! Itching to use deploy, but can’t commit yet!