将 React 基本应用程序上传到服务器
Upload react basic application to server
我正在尝试将以下内容上传到我的个人服务器以查看其工作原理:
https://github.com/remarkablemark/universal-react-tutorial
我试过在这里更改端口:(server.js)
require('babel-register')({
presets: ['react']
});
var express = require('express');
var app = express();
app.use(express.static('public'));
app.use(require('./routes/index.jsx'));
var PORT = 80;
app.listen(PORT, function() {
console.log('http://localhost:' + PORT);
});
但是当我输入相应的 url 我得到这个:
**
Index of /ReactServer
Parent Directory
Component.jsx
client.js
public/
routes/
server.js
webpack.config.js
Apache Server at www.alessandrosantese.com Port 80
**
我可以看到该应用程序在 http://localhost:3000/ 上运行良好,但我想在服务器上对其进行测试(我从未在实时服务器上部署过 React 应用程序)
这更多是将 node.js
部署到远程服务器。
我建议你使用 heroku
按照 these 个步骤将您的应用程序轻松部署到他们的服务器。
我正在尝试将以下内容上传到我的个人服务器以查看其工作原理:
https://github.com/remarkablemark/universal-react-tutorial
我试过在这里更改端口:(server.js)
require('babel-register')({
presets: ['react']
});
var express = require('express');
var app = express();
app.use(express.static('public'));
app.use(require('./routes/index.jsx'));
var PORT = 80;
app.listen(PORT, function() {
console.log('http://localhost:' + PORT);
});
但是当我输入相应的 url 我得到这个:
**
Index of /ReactServer
Parent Directory
Component.jsx
client.js
public/
routes/
server.js
webpack.config.js
Apache Server at www.alessandrosantese.com Port 80
**
我可以看到该应用程序在 http://localhost:3000/ 上运行良好,但我想在服务器上对其进行测试(我从未在实时服务器上部署过 React 应用程序)
这更多是将 node.js
部署到远程服务器。
我建议你使用 heroku 按照 these 个步骤将您的应用程序轻松部署到他们的服务器。