当前位置:网站首页>低代码平台中的数据连接方式(上)
低代码平台中的数据连接方式(上)
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. 小结
边栏推荐
- Livox激光雷达硬件时间同步---PPS方法
- Centros 8 installation MySQL Error: The gpg Keys listed for the "MySQL 8.0 Community Server" repository are already ins
- 企业中台建设新路径——低代码平台
- centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
- 张平安:加快云上数字创新,共建产业智慧生态
- ROS learning (24) plugin
- STM32F4---PWM输出
- ROS学习(二十)机器人SLAM功能包——rgbdslam的安装与测试
- Integrated navigation: product description and interface description of zhonghaida inav2
- 2022 system integration project management engineer examination knowledge point: Mobile Internet
猜你喜欢

Schedulx v1.4.0 and SaaS versions are released, and you can experience the advanced functions of cost reduction and efficiency increase for free!

刨析《C语言》【进阶】付费知识【二】

ROS learning (24) plugin

Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 2)

Livox激光雷达硬件时间同步---PPS方法

ROS學習(23)action通信機制

1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效

大咖云集|NextArch基金会云开发Meetup来啦!

Reptile practice (VI): novel of climbing pen interesting Pavilion

ROS学习(24)plugin插件
随机推荐
Shell script quickly counts the number of lines of project code
2022 system integration project management engineer examination knowledge point: Mobile Internet
猫猫回收站
Flir Blackfly S工业相机:颜色校正讲解及配置与代码设置方法
【LeetCode】Day97-移除链表元素
Processing image files uploaded by streamlit Library
Shortcut keys commonly used in idea
Recent applet development records
传感器:土壤湿度传感器(XH-M214)介绍及stm32驱动代码
Recognition of C language array
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
Basic introduction and use of dvajs
Reptile practice (VI): novel of climbing pen interesting Pavilion
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
建议收藏!!Flutter状态管理插件哪家强?请看岛上码农的排行榜!
ZOJ problem set – 2563 long dominoes [e.g. pressure DP]
一片叶子两三万?植物消费爆火背后的“阳谋”
阿里云中间件开源往事
Flir Blackfly S 工业相机 介绍
刨析《C语言》【进阶】付费知识【一】