Skip to content

Commit

Permalink
Merge pull request #7 from Nonhuman-Nonsense/Leo
Browse files Browse the repository at this point in the history
hot reloading for server and client via proxy pass
  • Loading branch information
LeoFidjeland authored Apr 21, 2024
2 parents 6b297ed + 88977a0 commit d5dd06b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY server/ .
COPY --from=client-builder /usr/src/client/build /usr/src/client/build

# Expose the port that the server is running on
EXPOSE 3000
EXPOSE 3001

# Specify the command to run the server
CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"socket.io-client": "^4.7.5",
"web-vitals": "^2.1.4"
},
"proxy": "http://localhost:3001",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
Expand Down
5 changes: 5 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@
},
"devDependencies": {
"nodemon": "^3.0.3"
},
"nodemonConfig": {
"env": {
"NODE_ENV": "development"
}
}
}
9 changes: 6 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const openai = new OpenAI(process.env.OPENAI_API_KEY);
//Names of OpenAI voices
const audioVoices = ["alloy", "echo", "fable", "onyx", "nova", "shimmer"];

app.use(express.static(path.join(__dirname, "../client/build")));
if(process.env.NODE_ENV != 'development'){
//Don't server the static build in development
app.use(express.static(path.join(__dirname, "../client/build")));
}

io.on("connection", (socket) => {
//Set up the variables accessible to this socket
Expand Down Expand Up @@ -377,6 +380,6 @@ io.on("connection", (socket) => {
});
});

httpServer.listen(3000, () => {
console.log("Listening on *:3000");
httpServer.listen(3001, () => {
console.log("Listening on *:3001");
});

0 comments on commit d5dd06b

Please sign in to comment.