@@ -21,19 +21,62 @@ Make sure you've [`git`](https://git-scm.com/book/en/v2/Getting-Started-Installi
2121
2222Open terminal and follow these steps;
2323
24- - Step 1: Clone the repo.
24+ - ** Step 1** : Clone the repo.
2525
2626``` bash
2727git clone https://github.com/KhalisFoundation/sttm-web/
2828```
2929
30- You should now see a ` SikhiToTheMax-Web ` folder in your present working directory. Let's change directory to it.
30+ You should now see a ` sttm-web ` folder in your present working directory. Let's change directory to it.
3131
3232``` bash
3333cd sttm-web/
3434```
3535
36- - Step 2: Install dependencies.
36+ - ** Step 2** : Setup python version 3.12.
37+ - Install Python 3.12 (if not already installed)
38+ - On mac:
39+ ``` bash
40+ 41+ ```
42+ - On Linux
43+ ``` bash
44+ sudo add-apt-repository ppa:deadsnakes/ppa
45+ sudo apt update
46+ sudo apt install python3.12 python3.12-venv
47+ ```
48+
49+ - Create an isolated virtual environment
50+ ``` bash
51+ /path/to/python3.12 -m venv myenv
52+ ```
53+
54+ - Activate it
55+ ``` bash
56+ source myenv/bin/activate
57+ ```
58+
59+ - ** Step 3** : Setup node version 16
60+ - Install nvm (if not already installed)
61+ ``` bash
62+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
63+ ```
64+ - Restart the terminal or run the following to activate
65+ ``` bash
66+ export NVM_DIR=" $( [ -z " ${XDG_CONFIG_HOME-} " ] && printf %s " ${HOME} /.nvm" || printf %s " ${XDG_CONFIG_HOME} /nvm" ) "
67+ [ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR /nvm.sh" # This loads nvm
68+ ```
69+
70+ - Install node 16.20 using nvm
71+ ``` bash
72+ nvm install 16.20
73+ ```
74+ - Switch to node 16
75+ ``` bash
76+ nvm use 16.20
77+ ```
78+
79+ - ** Step 4** : Install dependencies.
3780
3881``` bash
3982# `ci` doesn't update package.json, and uses package-lock.json to install intended deps.
4386
4487This will use ` npm ` that is included with ` nodejs ` to install project dependencies.
4588
46- - Step 3 : Start the project.
89+ - ** Step 5 ** : Start the project.
4790
4891If you are running this project for the first time or did some change, run the following command to create a build and run it:
4992
@@ -59,17 +102,38 @@ npm start
59102
60103This will run a bunch of build tools and a ` nodejs ` server to deploy the code locally.
61104
62- - Step 4: Access your local dev environment of the SikhiToTheMax website
63-
64- ``` bash
65- # On mac OS X
66- open http://localhost:8080
67- # On Linux
68- google-chrome http://localhost:8080
69- # On windows
70- start chrome http://localhost:8080
71- # Or just open chrome and enter the URL manually.
72- ```
105+ - ** Step 6** : Setup ngrok
106+
107+ To avoid the API cors error, we can use ngrok to get a https url of project output.
108+
109+ - Install ngrok
110+ ``` bash
111+ # On mac OS X
112+ brew install ngrok
113+ ```
114+ ``` bash
115+ # On Linux
116+ sudo snap install ngrok
117+ ```
118+
119+ - Sign up & Get Auth Token
120+ - Go to https://ngrok.com and sign up/log in.
121+ - Find your Auth Token here: https://dashboard.ngrok.com/get-started/setup
122+
123+ - Add your auth token
124+ ``` bash
125+ ngrok config add-authtoken < your-token>
126+ ```
127+
128+ - Since this app runs on port 8080, expose it to ngrok
129+ ``` bash
130+ ngrok http 8080
131+ ```
132+ - Get the forwarding URL from the command output
133+ ``` bash
134+ Forwarding https://1234abcd.ngrok.io -> http://localhost:8000
135+ ```
136+ - Open ` https://1234abcd.ngrok.io ` to see project output
73137
74138## Contributing
75139
0 commit comments