Skip to content

Commit a957034

Browse files
committed
fix docker-compose-dev env file
1 parent e652e38 commit a957034

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

client/src/containers/Test.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
import React from 'react';
1+
import React, { useEffect, useState } from 'react';
2+
import axios from 'axios';
23

34
const Test = () => {
5+
const [testMsg, setTestMsg] = useState<string>('');
6+
7+
useEffect(() => {
8+
(async () => {
9+
const res = await axios.get('/api/test');
10+
setTestMsg(res.data.msg);
11+
})();
12+
}, []);
13+
414
return (
515
<div
616
style={{
@@ -9,10 +19,11 @@ const Test = () => {
919
display: 'flex',
1020
alignItems: 'center',
1121
justifyContent: 'center',
12-
fontSize: '2rem'
22+
fontSize: '2rem',
23+
fontWeight: 'bold'
1324
}}
1425
>
15-
This is A router Test
26+
{`${testMsg} ${process.env.REACT_APP_TEST_ENV}`}
1627
</div>
1728
);
1829
};

docker-compose-dev.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ services:
88
- webapp
99
ports:
1010
- 5500:5500
11-
env_file: ./server/.env
11+
env_file:
12+
- ./server/.env
1213
volumes:
1314
- ./server/src:/app/src
1415
restart: always
@@ -18,7 +19,8 @@ services:
1819
build:
1920
context: ./client
2021
dockerfile: Dockerfile.dev
21-
env_file: ./client/.env
22+
env_file:
23+
- ./client/.env
2224
volumes:
2325
- ./client/src:/app/src
2426
- ./client/public:/app/public

server/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
"scripts": {
1515
"test": "jest --coverage",
1616
"build": "cd config && tsc -p tsconfig.release.json",
17-
"test:watch": "jest --watch",
18-
"react-start": "cd ../client && npm start",
19-
"start": "nodemon",
20-
"dev": " concurrently \"npm run start\" \"npm run react-start\" "
17+
"test:watch": "jest --watch"
2118
},
2219
"author": "Nadav Podjarski",
2320
"dependencies": {

server/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ app.get('/api/start', (req, res) => {
1212
res.json({ msg: 'Start building your Postgres-Express-React Application' });
1313
});
1414

15+
app.get('/api/test', (req, res) => {
16+
res.json({ msg: 'This is a react router test' });
17+
});
18+
1519
const PORT = process.env.PORT || 5500;
1620

1721
app.listen(PORT, () => {

0 commit comments

Comments
 (0)