Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the project to work #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo

## Available Scripts

### Legacy node version

You'll need older version of node.js to run this project.

1. Install nvm (Node Version Manager) `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash`
2. Install an LTS version of Node.js (e.g., 18.x): `nvm install 18`
3. Set the installed version as the default: `nvm use 18`
4. Verify the Node.js version: `node -v` (should return v18.x)

In the project directory, you can run:

### `npm start`
Expand Down
26,753 changes: 15,966 additions & 10,787 deletions client/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"socket.io-client": "^2.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/Chat/Chat.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState, useEffect } from "react";
import queryString from 'query-string';
import React, { useEffect, useState } from "react";
import io from "socket.io-client";

import TextContainer from '../TextContainer/TextContainer';
import Messages from '../Messages/Messages';
import InfoBar from '../InfoBar/InfoBar';
import Input from '../Input/Input';
import Messages from '../Messages/Messages';
import TextContainer from '../TextContainer/TextContainer';

import './Chat.css';

const ENDPOINT = 'https://project-chat-application.herokuapp.com/';
const ENDPOINT = 'http://localhost:5001/';

let socket;

Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,15 @@ io.on('connect', (socket) => {
})
});

server.listen(process.env.PORT || 5000, () => console.log(`Server has started.`));
const PORT = process.env.PORT || 5001;

server.listen(PORT, () => {
console.log(`Server has started on port ${PORT}`);
}).on('error', (e) => {
if (e.code === 'EADDRINUSE') {
console.error(`Port ${PORT} is already in use. Try a different port.`);
} else {
console.error(`An error occurred: ${e.message}`);
}
process.exit(1);
});
Loading