Environment Setup - maayanzahavi/YouTubeProject-CppServer GitHub Wiki
Find the C++ server repository here under branch main
.
- Clone the repository to your local machine.
- Open a terminal in the cloned folder.
- In
src/main.cpp
, change the server port number if needed. - Execute the following command to start the server:
./server
The Node js server can be found here under branch mainPart4
.
- Make sure the C++ server is up and running (see here).
- Clone the relevant repository to your computer.
- Open terminal in the cloned folder.
- Run npm install to install dependencies.
- Create a new folder in the repository named config.
- Inside the config folder create the file .env.
- Add the following content to the .env file:
CONNECTION_STRING="{your_mongoDB_connection_string}/YouTube_101"
PORT={port_number}
TCP_SERVER_PORT={cpp_server_port_numer}
TCP_SERVER_IP=127.0.0.1
For example:
CONNECTION_STRING="mongodb://localhost:27017/YouTube_101"
PORT=8200
TCP_SERVER_PORT=5556
TCP_SERVER_IP=127.0.0.1
- Open MongoDB on your computer.
- Note that a JavaScript script will automatically run and initialize a YouTube_101 database when you run the server. Please make sure you don't have a DB with that called YouTube_101.
- Run the server using npm start (if you're using unix, run npm run startUnix instead).
- On your browser search for: http://localhost:{port_number} (the same port number you chose earlier).
- Make sure you have
MongoDB Compass
installed on your computer. If not, you can download it here. - Follow here to initialize the database (see branch
mainPart4
).
the React application is available here under branch mainPart4
.
Follow here to start the web application.
You can find the relevant repository here under branch mainPart4
.
- Make sure your Node js server is up and running (see here).
- Make sure your C++ server is up and running (see here).
- Clone the relevant repository to Android Studio
- Ensure your Android device is connected, or start an emulator.
- Configure the Base URL (detailed below).
- Run the project by clicking the run button in Android Studio.
The project is currently configured to run on port 8200. If you choose a different port, you need to update the BaseUrl in the Android project:
- Go to
res/values/strings.xml
. - Update the BaseUrl string to the new port:
<string name="BaseUrl">http://10.0.2.2:{new_port_number}</string>
For example:
<string name="BaseUrl">http://10.0.2.2:8200</string>
If you want to run the application on a physical device, change the IP address to your computer's IP address:
- Connect your phone to the same WiFi network as your computer.
- Update the BaseUrl in
res/values/strings.xml
:<string name="BaseUrl">http://{your_computer_ip}:{port_number}</string>
For example:
<string name="BaseUrl">http://192.168.1.10:8200</string>