How to compile a local branch using the LAN IP address, in order to access the branch from any device connected to it?
This method of compiling is used for Web projects based on Angular CLI. It is using the WiFi router’s IP address in order to access a specific branch with any device connected to it.
We all have been in a position when before launching a new version of the project, a nasty bug appeared which could hit the pause button for launching.
How better to solve the bug if not using a branch?
How to know if the bug has been fixed before merging it if not with the help of a tester that knows how to compile a branch and get his or her’s hands dirty?
Below, you can find some tips and tricks we have acquired along the way that helped us greatly.
Steps to compile:
1. First, the project needs to be cloned locally. For this, use the “git clone” command in the terminal and add the project link (git clone + link);
2. After the project is cloned, access the project folder in the terminal and using the command “git checkout” + the desired branch, access the local branch;
3. Before serving the branch you need to find the Wifi router IP address. This can be found in the System Preferences/Network/Advanced/”TCP/IP”/IPv4 Address.
4. In addition, the project environment needs to be changed with the following API: https://IPv4 Address:4200/api (The environment API location depends on the project);
5. Compile the branch using the following command:
ng serve --host IPv4 Address --port 4200 --ssl
--ssl command encrypts the communication between the git clients and the git server using the https protocol)
6. After the branch is compiled successfully, it can be accessed by any device that is connected to the same LAN. In the browser add the URL: https://IPv4 Address:4200/api
Note: After entering the above URL an error “Your connection is not private” will be showing. Use the Advanced button to proceed to the entered URL.