Accessing Azure SQL database for my react web application - sql

I've deployed an Azure web application with a SQL database. For the frontend I use ReactJS. I’ve successfully connected to the SQL database with NodeJS, and I can execute queries and reach the data in the sql database. So at this point I want to use that data in the frontend. I can only see the data in my terminal, I guess I have a missing piece for the communication between the server side and the client side. So my question is how I can get the data to the frontend?
Happy for any suggestions.

You must create a endpoint that allow your frontend make a http request to your node app.
Your node app should get the data from the DB and return as response of the request.
Then your frontend will get the data you want.
frontend ---http request (ajax, fetch)-->backend node app --query-> database
Create a REST API with Node
Using Fetch
Client Tier is your React app (frontend)
Application Tier is your Node App (backend)
Database Tier the name talks for herself :D

Related

Azure APP Service average response time is more than 100 times than the service instance running in Localhost and in IIS

I have recently published my ASP .Net core (5.0) API database being used is Azure SQL Database as Azure App service. But while testing Api calls and their response time, I found something very strange. Azure App service response time is much higher compared to localhost running Api.
I am new to azure app service so if anybody could give me some insight on this what's going on.
I am adding app insights of api hosted in Azure and response time while running its locally
Azure Response:
Postman response :
Localhost response:
Update :
Both azure service and Azure Sql server in same resource group and in same region (Central US)
Dylan Morley's comment is useful, please follow his suggestion to investigate this issue.
Troubleshooting Steps:
Create a very simple api to test and check the response time.
If the response time is about the same, then it can be considered that the problem is not related to the App Service.
If the difference is large, please check the logging level.
Please add additional log in your code to check where the is time is spent.

How does API work with application server?

I've read that application server can be accessed via API. But I don't get the mechanism of that process. Does it work like that?
So, as for me, firstly, client sends an HTTP request to a hardware server. Here we start to looking for some data. Then, we connect with application server via API. And then something that was found in hardware server changes with application server. And after all, client receives this changed file. Am I right?
And it looks like API always works only with application server. Is it true?

Azure Data Sync Rest API

Is there a REST API that I can use instead of this application? I currently using the Data_Sync_Preview_REST_API.pdf but I think it doesn't have the capability to add your local server to Azure. I need the functionality with the arrows below for Register and Submit Agent Key via API or something that can Add an on-premises SQL Server database with API.

Windows Azure - sql database with api

I have SOAP services with data. I want to download all data from that service and upload it to my own server and then use these data from my server (don't worry I have permission for that). I want to do it because now I don't have function from that service which I need.
I want to use Windows Azure for this and I think SQL Database scenario would be best. Now I have classes for previous SOAP service so I think EF Code first would help me with creating database and I upload data somehow. But what about API? How can I access my data from windows phone or tablet? Is azure database enought or I must create more? Is there any good article for that?
I think what you are saying, is that you are aggregating data from several sources and storing the information in your own database. And, you would like your database to be Azure Database. Then, you want to build an API to expose the data you retrieved.
If this is indeed your goal, then yes, Azure will do everything you need. I'd recommend checking out Web API in conjunction with your Azure deployment. I've used this scheme with some success over the past year.
Warning: You should know that Azure Database does not have an SLA which means that Microsoft does not guarantee any level of performance including transactions/second. This means that if your API has a high load, you could end up getting throttled heavily in an unpredictable way. I've been bitten by this before and ended up moving my data to Azure Table Storage instead.
Windows Azure gives you a few options to expose an API to your mobile clients:
You could build an API yourself with the ASP.NET Web API (and use SQL Azure as backend): Mobile-friendly REST service using ASP.NET Web API and SQL Database
You can use Windows Azure Mobile Services, this does all the heavy lifting of building a backend for you

Sending a message directly form a Rails app to a Node.js and Socket.io push server

I'm building a client side Browser app that uses a server side json API written in Ruby Rails 3 via AJAX. this all works great, no problems. but I want to push data to the users client when other users do things via the API with out having to have the client constantly be polling the server for new data.
so I set up a Node.js and Socket.IO app to act as a push server. Clients connect tot he Socket.IO server and subscribe to the channels they need to. but question is How can I get the Rails app to send a message to the Node server to be emitted on those channels?
I suppose I could just generate a post request to a special rout on the Node server but is there a better way? and how can I ensure that post request came form my rails app?
Use a Redis (redis.io) Pub/Sub channel to publish a message from your rails app, and subscribe to the Redis channel from the Node.js app.