stub basic connection

This commit is contained in:
Sorrel Bri 2020-01-07 13:03:59 -08:00 committed by sorrelbri
parent 709220e19e
commit 39cdef0b02
4 changed files with 25 additions and 3 deletions

View file

@ -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"

View file

@ -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);
/**

View file

@ -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>
);
}

View 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
}