当前位置:网站首页>低代码平台中的数据连接方式(上)
低代码平台中的数据连接方式(上)
2022-07-06 18:34:00 【InfoQ】
1. 前言
- 在(上)篇中,我们将介绍经典的单 API 通信数据连接方式 - 简单的单 API 连接方式存在的问题 - 相应解决方案。
- 在(下)篇中,我们将介绍在低代码时代发展起来的 API 编排 - FaaS - 数据库直连等新型方案。
2. 传统手工模式下动态数据的获取和渲染
var menuId = $( "ul.nav" ).first().attr( "id" );
var request = $.ajax({
url: "script.php",
method: "POST",
data: { id : menuId },
dataType: "html"
});
request.done(function( msg ) {
$( "#log" ).html( msg );
});
request.fail(function( jqXHR, textStatus ) {
alert( "Request failed: " + textStatus );
});
// 1. Import *useState* and *useEffect*
import React, {useState, useEffect} from 'react';
import './App.css';
function App() {
// 2. Create our *dogImage* variable as well as the *setDogImage* function via useState
// We're setting the default value of dogImage to null, so that while we wait for the
// fetch to complete, we dont attempt to render the image
let [dogImage, setDogImage] = useState(null)
// 3. Create out useEffect function
useEffect(() => {
fetch("https://dog.ceo/api/breeds/image/random")
.then(response => response.json())
// 4. Setting *dogImage* to the image url that we received from the response above
.then(data => setDogImage(data.message))
},[])
return (
<div className="App">
{/* 5. Using *dogImage as* the *src* for our image*/}
{dogImage && <img src={dogImage}></img>}
</div>
);
}
export default App;
new Vue({
el: '#app',
data () {
return {
info: null
}
},
mounted () {
axios
.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(response => (this.info = response))
}
})
3. 低代码最初的数据连接方式 —— 通过 API URL 进行数据通信
4. 问题产生 —— 低代码平台实际落地中的阻碍
4.1 前后端数据格式不匹配问题

{
"status":0,
"msg":"",
"data":{
...其他字段
}
}
4.2 跨域问题

5. 浏览器端的数据映射机制

6. 浏览器端请求 / 接收适配器

7. API 代理
7.1 统一 API 代理方案


7.2 后端数据映射及后端请求 / 接收适配器


- AMIS 作为一个开源项目,在许多时候可能会被作为独立依赖引入到项目中,在没有 API 代理机制的情况下前端方案可以解决一部分问题。
- 如果在配置项中指定请求为 raw: 则网络请求不会经过 API 代理发送,这时如果需要对数据进行格式化,则需要借助前端方案。
8. 小结
边栏推荐
- 6 seconds to understand the book to the Kindle
- 机器人队伍学习方法,实现8.8倍的人力回报
- 2022/0524/bookstrap
- Mongodb checks whether the table is imported successfully
- Correct use of BigDecimal
- 传感器:DS1302时钟芯片及驱动代码
- [unique] what is the [chain storage structure]?
- centos8 用yum 安装MySQL 8.0.x
- 2022 system integration project management engineer examination knowledge point: Mobile Internet
- 一文带你走进【内存泄漏】
猜你喜欢
[unique] what is the [chain storage structure]?
MySQL execution process and sequence
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
场景实践:基于函数计算快速搭建Wordpress博客系统
The mega version model of dall-e MINI has been released and is open for download
FLIR blackfly s usb3 industrial camera: white balance setting method
解密函数计算异步任务能力之「任务的状态及生命周期管理」
STM32F4---通用定时器更新中断
Can't you understand the code of linked list in C language? An article allows you to grasp the secondary pointer and deeply understand the various forms of parameter passing in the function parameter
New job insights ~ leave the old and welcome the new~
随机推荐
CISP-PTE之命令注入篇
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
Jacob Steinhardt, assistant professor of UC Berkeley, predicts AI benchmark performance: AI has made faster progress in fields such as mathematics than expected, but the progress of robustness benchma
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
Cisp-pte practice explanation (II)
Correct use of BigDecimal
Errors made in the development of merging the quantity of data in the set according to attributes
Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
Reptile practice (VI): novel of climbing pen interesting Pavilion
Flir Blackfly S USB3 工业相机:白平衡设置方法
Unicode string converted to Chinese character decodeunicode utils (tool class II)
Shell script quickly counts the number of lines of project code
ROS learning (23) action communication mechanism
The cradle of eternity
Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
The foreground downloads network pictures without background processing
Flir Blackfly S USB3 工业相机:计数器和定时器的使用方法
传感器:土壤湿度传感器(XH-M214)介绍及stm32驱动代码
centos8 用yum 安装MySQL 8.0.x
ROS learning (22) TF transformation