I am trying to upload image files to Heroku using Node backend and I can make it work, The same exact process work just fine on Localhost testing but after deploying my project to Heroku and testing it, there is an error in the process and the files wont upload
BACKEND:
let storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './uploads')
},
filename: function (req, file, cb) {
cb(null, file.originalname)
}
})
const upload = multer({storage: storage})
router.post('/', …Run Code Online (Sandbox Code Playgroud) 我尝试设置一些环境。Heroku 上的变量和我所做的,打开 Heroku 仪表板时我可以看到应用程序中的变量。但是当我尝试从我的应用程序访问变量时,它会返回undefined任何想法吗?
componentDidMount() {
console.log('this env' , process.env.backEndServer) // undefined
}
Run Code Online (Sandbox Code Playgroud)
检查 Heroku cli:
$ heroku config:get backEndServer // https://myserver.com
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Xcode中构建我的项目并且它工作得很好但最后我得到一个警报说:
验证您的帐户的开发者应用证书是否在您的设备上受信任.在Artium的iphone上打开设置并导航到常规 - >设备管理,然后选择您的开发人员应用程序证书以信任它.
当我通过设置时,Device Management选项丢失.
请注意,我从手机中删除项目并重建它后发生了.
我查看了首选项,我登录了Xcode中的个人资料.
我试图用axios发送http请求,但我得到404错误,原因是请求在url的开头用本地主机ip发送,为什么会发生这种情况?
JS:
function getWeather() {
axios.get('api.openweathermap.org/data/2.5/weather', {
params: {
lat: 30.18,
lon: 30.87,
appid: '57d9478bc08bc211f405f45b93b79272'
}
})
.then(function(response) {
console.log(response);
})
.catch(function(error) {
console.log(error);
})
};
getWeather();
Run Code Online (Sandbox Code Playgroud)
错误:
http://127.0.0.1:5500/api.openweathermap.org/data/2.5/weather?lat=30.18&lon=30.87&appid=57d9478b#####################3b79272 404 (Not Found)
Run Code Online (Sandbox Code Playgroud) 我无法确定它是否因此发生,但我使用更新了我的项目名称react-native-rename并在几个小时后重建了项目。从那时起我无法在设备上重新加载我的项目。
注意\n在模拟器上它可以工作,而不能仅在真实设备上工作。运行npm-start返回:
\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 Running Metro Bundler on port 8081. \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 Keep Metro running while developing on any JS projects. Feel free to \xe2\x94\x82\n\xe2\x94\x82 close this tab and run your own Metro instance if you prefer. \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 https://github.com/facebook/react-native \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\n\nLooking for JS files in\n /Users/Project/Client \n\n\nMetro Bundler ready.\n\nLoading dependency graph, done. \nRun Code Online (Sandbox Code Playgroud)\n\n并且无论如何都不会更新。我尝试按照此处的建议查找.lock内部#4357,但我找不到该目录,所以我相信这不是问题。.git.git
我也rm -rf /usr/local/var/run/watchman && brew uninstall watchman && brew …
我有<TextInput/>,我想使其模糊并在外部轻按时切换键盘,<TextInput/>我尝试了此解决方案,但没有任何运气。
import React, { Component } from 'react'; import { AppRegistry, Dimensions, StyleSheet, Text, TouchableHighlight, View, Image, TextInput, ScrollView, Keyboard, TouchableWithoutFeedback } from 'react-native'; import { Button } from 'react-native-elements'; class CounterextendsComponent {
render() {
return (
<View
style={styles.container}
onPress={this.focusOff}
>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<View>
<TextInput
ref="numberInput"
id={this.props.id}
style={styles.title}
keyboardType='numeric'
maxLength={2}
value={this.state.keys.toString()}
onChange={(event) => this.updateKeysWithInputHandler(event.nativeEvent.text)}
/>
</View>
</TouchableWithoutFeedback>
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个对象数组,我想先按日期排序,然后按其数值排序.
let arr = [
{date: 2018-06-19 12:05:43.232Z, value: 3},
{date: 2018-06-20 12:05:43.232Z, value: 4},
{date: 2018-06-18 12:05:43.232Z, value: 2},
{date: 2018-06-20 12:05:43.232Z, value: 4},
{date: 2018-06-19 12:05:43.232Z, value: 5},
{date: 2018-06-18 12:05:43.232Z, value: 5},
{date: 2018-06-20 12:05:43.232Z, value: 5},
{date: 2018-06-19 12:05:43.232Z, value: 4},
]
Run Code Online (Sandbox Code Playgroud)
我想按日期和值对每个索引进行排序,结果如下:
let arr = [
{date: 2018-06-18 12:05:43.232Z, value: 2},
{date: 2018-06-18 12:05:43.232Z, value: 5},
{date: 2018-06-19 12:05:43.232Z, value: 3},
{date: 2018-06-19 12:05:43.232Z, value: 4},
{date: 2018-06-19 12:05:43.232Z, value: 5},
{date: 2018-06-20 12:05:43.232Z, value: …Run Code Online (Sandbox Code Playgroud) 我试图使一个屏幕充当常规StackNavigation对象内的模态。意思是,我希望所有屏幕都充当卡(从侧面渲染),但一个屏幕却充当模态(从底部渲染),但是它只是不起作用,所有屏幕都是从侧面渲染。
码:
export const Modal = StackNavigator({
ReportPage: {
screen: ReportContainer
}
}, {
headerMode: 'none',
mode:'modal'
})
export const Main = StackNavigator({
Feed: {
screen: Feed
},
ModalScreen: {
screen: Modal
}
}, {
headerMode: 'none'
})
Run Code Online (Sandbox Code Playgroud) 我有异步方法被调用,我需要在第一个循环中渲染它的值,所以它将被传递给正在渲染的下一个组件,我无法完成id.在返回值之前呈现组件,这会导致prop undefined通过.任何想法如何延迟渲染,直到值返回?
代码示例:
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
valueHere:''
}
}
componentWillMount() {
axios.post(url, {
username:this.state.username
})
.then((res) => {
this.setState({
valueHere:res.data
})
})
}
render() {
return(
<AnotherComponent
someValue={this.state.valueHere}
/>
)
}
}
export default class AnotherComponent extends Component {
constructor(props) {
super(props);
}
render() {
console.log(this.props.someValue) // undefined
return(
<View/>
)
}
}
Run Code Online (Sandbox Code Playgroud)