stub basic connection
This commit is contained in:
parent
dc7b895dd6
commit
b2d9eaca0d
4 changed files with 25 additions and 3 deletions
|
@ -13,11 +13,14 @@
|
|||
"socket.io-client": "^2.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"start": "REACT_APP_ENVIRONMENT='development' react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"flow": "flow"
|
||||
"flow": "flow",
|
||||
|
||||
"predeploy": "REACT_APP_ENVIRONMENT=production npm run build"
|
||||
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
|
|
|
@ -12,7 +12,7 @@ var http = require('http');
|
|||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3000');
|
||||
var port = normalizePort(process.env.PORT || '8000');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import React from 'react';
|
||||
import './App.scss';
|
||||
import config from './config';
|
||||
|
||||
function App() {
|
||||
let fetchData = {};
|
||||
fetch(config.apiAddress).then(res => {console.log(res);fetchData = res.body}).then(() => console.log(fetchData))
|
||||
return (
|
||||
<div className="App">
|
||||
<h1>React Boilerplate</h1>
|
||||
{fetchData ? <p></p> : <></>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
15
packages/server/packages/play-node-go/src/config.js
Normal file
15
packages/server/packages/play-node-go/src/config.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const production = {
|
||||
apiAddress: null
|
||||
}
|
||||
|
||||
const development = {
|
||||
apiAddress: 'http://localhost:8000'
|
||||
}
|
||||
|
||||
const config = process.env.REACT_APP_ENVIRONMENT === 'production'
|
||||
? production
|
||||
: development
|
||||
|
||||
export default {
|
||||
...config
|
||||
}
|
Loading…
Reference in a new issue