You can now either connect to the dedicated VM Backend, or use your local backend instead for development. Instructions for each are starting up each are below:
Note: Ensure that your Postgres Tables are up to date if there has been any commits by running the ''TableAndMockData_loader.sql' script. More instructions for that in the following section 'Recent Postgres Updates'
The Postgres schema tables are being frequently, and 'TableAndMockData_loader.sql' must be ran to update the changes to the tables
You MUST run the data loader from the directory it is in, the command to run it is: 'psql -U $username -d $dbname -a -f .\TableAndMockData_loader.sql'
Note that $username is equal to your Postgres username, and $dbname is equal to your Postgres database name
In /backend-server's root directory, create a file called '.env', and define the following variables within it
3. ACCESS_TOKEN_SECRET - Open a terminal window. Run 'node'. Run the command: 'require('crypto').randomBytes(16).toString('hex')' This will generate a random varchar string, set the variable equal to it
4. REFRESH_TOKEN_SECRET - Repeat the same process, run 'node', then the command: 'require('crypto').randomBytes(16).toString('hex')' and set the variable equal to it
In /sproutshare-client's root directory, create a file called '.env', and define the following variables within it
1. NODE_SERVER - Set this equal to your local IPV4 IP Address. You can get this by running 'ipconfig' in a terminal
NODE_SERVER = 'http://192.168.3.7:3000'
1. Install Android Studio
Ensure Expo is installed: Expo.
click this link to make expo account: Expo Account.
Ensure Node.Js is installed: Node.js
In order to communicate between node and react native, the server must be ran on an https server (not local host). This is where localtunnel helps out by forwarding your localhost server to a https server
1. Install MongoDB v4.4.16: https://www.mongodb.com/try/download/community?tck=docs_server
1. Install Postgres: https://www.postgresql.org/download/
3. Open a new terminal window. Now, port forward the server to localtunnel: "lt --port 3000" (it will give you a https server to point the react native app to)
0. Ensure that the nodeServer variable in App.js points to the localtunnel link that was generated. This must be done everytime a new server is created.
1. Run an android emulator on your PC with Play Store Connectivity (the ones with the play store logo next to it)
6. When making changes in the front end, to see some changes you need to reload the app by entering: "r"
Local DB requirements
- Install mongodb v3.6.23 or above
- Install postgres 14.5
- Run SQL data loader (maybe we can do this?)
How To Run
- Install dependencies by using "npm install" from the SproutShare directory.
- Run using "npm start" from the SproutShare directory.
- Start mongodb by entering 'mongod' in a terminal window such as Powershell (windows)
- The DB name is SproutShareNoSQL. However, you can change this for your local enviroment.
- Application URL: localhost:3000/
Notes:
Added ejs for dynamic webpages
Put some ejs pages in the view folder as a temporary way to see the application behavior.
These will be replaced in production by react native views, and at most repurposed for testing