我在我的远程桌面上安装了 React 并开发了一个网页。我如何在生产服务器上做同样的事情?
I have installed React on my remote desktop and developed a web page. How do I go about doing the same on production server?
我是 react.js 的新手。
我安装了节点并在我的远程桌面上做出反应,并使用本地 ajax 文件开发了网页。
我是否必须在我的生产服务器上执行相同的步骤,或者我可以直接将更改(即反应文件)推送到生产环境?
至于我的本地文件,例如 App.js、index.html、ajax 文件、图像,我可以在我的产品设置后推送它们吗?
另一个问题:
对于我的本地文件,我必须在 url 前面加上我的本地主机端口号。
我怎样才能摆脱它?
例如:
在我的 ajax 调用中,我将数据类型用作跨域调用的 jsonp,并将跨域设置为 true。 ajax 调用有效,但我必须在 ajax url.
中提及本地主机端口号
而不是 http://localhost:7070/reactapp/app/components/ajax/insertData.php 我希望它是-> react-app/app/components/ajax/insertData.php,这样它就可以在我的生产服务器上运行。
请参阅下面的代码。
addData()
{
$.ajax({
crossDomain: true,
url:"http://localhost:7070/reactapp/app/components/ajax/insertData.php",
data:
{inQueue:this.state.inQTxt,totEmails:this.state.totalEmailsTxt},
dataType: 'jsonp',
success: function(result) {
}.bind(this),
error: function(xhr, status, error) {
}.bind(this)
});
}
您可以按照npm步骤投入生产
对于 URL 生成器,您可以使用像
这样简单的东西
我是 react.js 的新手。 我安装了节点并在我的远程桌面上做出反应,并使用本地 ajax 文件开发了网页。
我是否必须在我的生产服务器上执行相同的步骤,或者我可以直接将更改(即反应文件)推送到生产环境? 至于我的本地文件,例如 App.js、index.html、ajax 文件、图像,我可以在我的产品设置后推送它们吗?
另一个问题: 对于我的本地文件,我必须在 url 前面加上我的本地主机端口号。 我怎样才能摆脱它? 例如:
在我的 ajax 调用中,我将数据类型用作跨域调用的 jsonp,并将跨域设置为 true。 ajax 调用有效,但我必须在 ajax url.
中提及本地主机端口号而不是 http://localhost:7070/reactapp/app/components/ajax/insertData.php 我希望它是-> react-app/app/components/ajax/insertData.php,这样它就可以在我的生产服务器上运行。 请参阅下面的代码。
addData()
{
$.ajax({
crossDomain: true,
url:"http://localhost:7070/reactapp/app/components/ajax/insertData.php",
data:
{inQueue:this.state.inQTxt,totEmails:this.state.totalEmailsTxt},
dataType: 'jsonp',
success: function(result) {
}.bind(this),
error: function(xhr, status, error) {
}.bind(this)
});
}
您可以按照npm步骤投入生产
对于 URL 生成器,您可以使用像
这样简单的东西