我正在尝试将node-red的一些输出作为JSON对象发送到使用Flask的后端。在后端,我的目标是将JSON数据转换为 const DrawerNavigator = createDrawerNavigator({
Example: ScreenExample
},
{
contentComponent: CustomDrawerContentComponent,
drawerWidth: width * 0.63,
contentOptions: {
activeTintColor: blue,
inactiveTintColor: "rgb(105,105,104)",
itemsContainerStyle: {
textAlign: "center"
},
labelStyle: {
fontFamily: "RobotoCondensed-Regular",
fontWeight: "400",
fontSize: 17,
marginLeft: -5
}
},
iconContainerStyle: {
opacity: 1
}
}
const CustomDrawerContentComponent = props => (
<SafeAreaView
style={{ flex: 1, backgroundColor: white }}
forceInset={{ top: "never" }}
>
<SafeAreaView style={{ flex: 0, backgroundColor: "rgb(63,103,149)" }} />
<View
style={{
alignItems: "center",
backgroundColor: "rgb(63,103,149)",
shadowOpacity: 0.3,
shadowOffset: {
height: 5
}
}}
>
<Image
source={require("./src/assets/Icon-Transparente.png")}
style={{ height: 150, width: 150 }}
resizeMode="contain"
/>
</View>
<ScrollView>
<DrawerItems {...props} />
</ScrollView>
</View>
</SafeAreaView>
格式并将文件保存在本地。我刚刚开始使用node-red,但不确定如何实现?后端必须在python中。
使用Flask的python代码:
.dot
我收到的红色节点控制台错误是
from flask import Flask,request
app = Flask(__name__)
@app.route('/',methods=['POST','GET'])
def hello_world():
print (request.is_json)
content = request.get_json()
print (content)
return 'JSON posted'
python终端上的错误:
127.0.0.1--[15 / Apr / 2019 15:57:42]“ GET / HTTP / 1.1” 500-
没有错
答案 0 :(得分:0)