当前位置:网站首页>低代码平台中的数据连接方式(上)
低代码平台中的数据连接方式(上)
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. 小结
边栏推荐
- 最近小程序开发记录
- Get to know MySQL for the first time
- Dall-E Mini的Mega版本模型发布,已开放下载
- New job insights ~ leave the old and welcome the new~
- 组合导航:中海达iNAV2产品描述及接口描述
- Robot team learning method to achieve 8.8 times human return
- POJ 3177 redundant paths POJ 3352 road construction (dual connection)
- MySQL's most basic select statement
- 一片葉子兩三萬?植物消費爆火背後的“陽謀”
- When grep looks for a process, it ignores the grep process itself
猜你喜欢
随机推荐
BigDecimal 的正确使用方式
Blackfly s usb3 industrial camera: buffer processing
centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
Shortcut keys commonly used in idea
ROS learning (21) robot slam function package -- installation and testing of orbslam
centos8安装mysql报错:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
Time synchronization of livox lidar hardware -- PPS method
MySQL execution process and sequence
张平安:加快云上数字创新,共建产业智慧生态
1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
Flir Blackfly S USB3 工业相机:计数器和定时器的使用方法
ROS学习(24)plugin插件
Command injection of cisp-pte
RC振荡器和晶体振荡器简介
Make DIY welding smoke extractor with lighting
New job insights ~ leave the old and welcome the new~
UC伯克利助理教授Jacob Steinhardt预测AI基准性能:AI在数学等领域的进展比预想要快,但鲁棒性基准性能进展较慢
The mega version model of dall-e MINI has been released and is open for download
Recognition of C language array
ROS learning (XIX) robot slam function package cartographer








