简体   繁体   中英

Accessing Azure SQL database for my react web application

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM