change build script

This commit is contained in:
S.long 2020-05-07 09:55:01 +07:00
parent 20e59fa0d4
commit e61dca1b60
3 changed files with 20 additions and 2 deletions

View File

@ -11,10 +11,11 @@
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"start-app": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"start": "node server.js"
},
"eslintConfig": {
"extends": "react-app"

13
server.js Normal file
View File

@ -0,0 +1,13 @@
const path = require('path');
const express = require('express');
const app = express();
const publicPath = path.join(__dirname, '.', 'build');
const port = process.env.PORT || 3000;
app.use(express.static(publicPath));
app.get('*', (req, res) => {
res.sendFile(path.join(publicPath, 'index.html'));
});
app.listen(port, () => {
console.log('Server is up!');
});

View File

@ -3,6 +3,10 @@ import logo from './logo.svg';
import './App.css';
function App() {
return (
<h1>React My </h1>
)
return (
<div className="App">
<header className="App-header">