Ionic 4, mySQL and Node.js

#1

I am using mySQL for my database (remote server). I am trying to make restful api using Node.js (still new). I am able to retrieve the data value from mySQL on my console terminal. However, I need to display the data value on my ionic application. Are there any tutorials or reference for me. Thank you.

#2

https://www.joshmorony.com/building-a-hotel-booking-app-with-ionic-2-mongodb-node/

#3

Thanks for the reference. I saw this before but i don’t know how to convert mongoDB to mySQL. Sorry for my lack of knowledge.

#4

There are multiple tutorials on how to connect ionic to a MySQL DB.
Since MySQL is not running directly on the phone, you link your app via a PHP API or NodeJs API linked to a databse.
The workflow would simply be:

  1. Prepare your data and or then make http call to Nodejs or PHP API via GET,POST,PUT,DELETE
  2. Depending on the call you made you’ll get feedback based on your API design.
  3. Process the feedback and probably display it on your app.
  4. Repeat other different calls may be based on need.

Here is a tutorial by Josh Morony showcasing how to consume a MySQL DB via Ionic App.
https://www.joshmorony.com/integrating-a-backend-with-ionic/

=> NodeJs MySQL API
https://www.codementor.io/julieisip/learn-rest-api-using-express-js-and-mysql-db-ldflyx8g2

The API endpoints in the codementor tutorial would be what you make calls to in your ionic app if you were using NodeJs instead of a PHP API.

=> NodeJS MySQL Tutes
https://www.sitepoint.com/using-node-mysql-javascript-client/
W3Schools