Connect to MySQL using Ionic Framework without api layer - mysql

Is it possible to connect to a MySQL database directly from an Ionic application without an integration/api layer?
All the answers I found online suggest to create API in php or nodejs, but I would like to develop a sql client and the whole point of the application is to be able to make queries directly from the client device.
I cannot use the node mysql library from client side.
I am using Ionic 6 React.

No, as noted by Mostafa Harb, you cannot directly access a MySQL database in the cloud from a device. You'll need to use some kind of API.
The basic flow:
Ionic app authenticates to the API if necessary.
Ionic app uses Axios or Fetch to use the API to query the cloud database.
The API returns the response in a format the Ionic app understands.
The good thing about Ionic is that it is mostly framework-agnostic, so you can use any API you like.
Personally, I use Drupal, which is a PHP-based CMS that has support for providing access to Ionic via REST, JSON:API, or GraphQL (or a mix of the three).

Related

Using AWS SDK directly in client app instead of api gateway

I have one funny but strange question.
As you know we can use aws-sdk directly in react native or react js app.
It means we can execute all DynamoDB SDK commands from react native/js app.
so if table is already created in dynamodb either by console or any framework, we can use aws-sdk from client app to directly put item in dynamodb table instead of calling the api gateway & telling lambda to use aws-sdk to put item in dynamodb.
let me know what are cons for it & if this is even feasible or not.

Splitting web-app and mobile-app request in Yii2

I created a restful web-app platform using yii2 framework. It is working with no problems using a browser. Now I'm developing a mobile-app with angular and ionic and I'm searching for some guide to help me splitting the request from browser and app. Using the browser the web-app is configured to have a html view response, how can I detect a mobile-app request to change response in JSON format in each controller/action?
It's my first mobile-app development.
I just fighted this same war this week and I ended up splitting the folders and generating a new yii-app with fresh controllers just for the api.
I tried creating the api folder inside the web backend project, but I had to much problems with redirections, and as I was working from Android emulator fueled by Expo it was almost impossible to reach the api inside my localhost from outside.
At the end in the API REST you just reuse the database connection, rest of files are new. So there is no much to win in placing it in the same folder/project.
By the way, read this documentation: Implementing RESTful Web Service APIs in Yii2
As a code example you could check my yii2 web app: https://github.com/jvidalv/fempoble
And the api that works with the web: https://github.com/jvidalv/api-fempoble

Azure blob access from Html web app

I have a html Web App running off of Azure. I'm trying to figure out how to write and read to a blob from there. I understand I will need a Shared access key, connection string, use a HTTPS and/or HTTP request, use CORS, but now I'm just trying to fill in some blanks about how to set up the endpoints and if I need something in the back end of the web app. How can implement setting up the endpoints with the CORS? Do I need to set up a logic app? What else do I need to set up with the Web App? Will it be better to set up on a Virtual machine? Thank you in advance.
Jonathan
There are several web apps tutorials used with blob storage. Some tutorials i'd highly recommend are as below:
Gallery Photo Web App tutorial:
Provides an example with sample code on how to use a web application with Azure blob storage
Using Azure storage with hosted Azure Web App:
Provides an example on how to integrate and use storage with Azure hosted Web app, including the source code.
Video tutorial:
Video Tutorial showing the use of Azure web App and Storage operations.
These should get you started.

Azureml Web Service - How to create a Rest Service from an Experiment to be consumed by a mobile app?

I've looked all over the google and stackoverflow for the answer but I cant seem to find it. I'm trying to get the output from an azure experiment to an app. I've made the app using ibuildapp and google forms. How can I use the inputs from the google form, pass it to azure and get an output to display on the app?
In order to access your model from your app you want to create a rest service. See here.
http://azure.microsoft.com/en-us/documentation/articles/machine-learning-publish-a-machine-learning-web-service/
Then you will consume this rest serivce from your app using a standard http client. Sample code is available here.
http://azure.microsoft.com/en-us/documentation/articles/machine-learning-consume-web-services/

framework to be used for UI of node.js backend

I am trying to develop an application using node.js.
Since the same application can be accessed from a mobile device sometime later, it is expected that the APIs will return the json data, and not forward the request to a page after setting the appropriate request parameters.
I am mostly a Java backend guy and a newbie in the UI frameworks(including javascript with just basic knowledge).
I was wondering which UI technologies should i use for the UI? Should i go for plain HTML or php or anything else? Also, will the other UI Application be a webapp and deployed probably in a web server?
Started to use the express module for node.js, and it is awesome. It provides jade(and from which the basic UI can be created very easily) but i have not had the chance to see much into it. Also if i start to use jade, i guess in my app.js file, i will need to forward the request to a page, and not return json data, which i want to avoid.
Can someone suggest me which UI technologies should be the way to go?
The UI is supposed to be quite rich, and with lots of functionalities.
Thanks
Tuco
I would definitely recommend using express.js. As you mentioned you can render jade templates and this will display to the user as html.
You can also send plane old JSON data to the client by using the res.json() method made available with express.
Backbone is a client side framework where you can make single page web applications, and all the html templates are rendered on the clients machine rather than on the web server. Data is persisted to a backend database by using a RESTful API and the following ajax requests. GET, POST, PUT and DELETE.
Later down the line you can use this RESTful API for your mobile app.