05. Clone the Repo (backend)
Create a directory on your computer to hold the two repos. When we're all done we will have a folder (shSMS) with two folders inside (shsms-frontend and shsms-backend). I'm going to make mine in the home directory (
~
) of my machine. To be like me, open a terminal and typecd ~ && mkdir shSMS && cd shSMS && && git clone https://github.com/pywkt/shsms-backend.git
Go in to the repo folder
cd shsms-backend
Create an
.env
file that will hold our environmental variables.touch .env
What's an environmental variable? Glad you asked! It's basically some information that we need to use in our app that is specific to only us and we don't want anyone else to know about it.
.env
files are not published to the internet and should never be made public.Open the
.env
file you just created and add the following, be sure to update these with your own information
Note: Files that begin with "." are hidden by default on many machines. You may need to change your folder settings to see them in the folder.
Personally, I prefer to just do it all in the terminal because we're already in there, why bother with all that double-clicking 🤷♀
Using the terminal:
nano .env
Copy/Paste the sample below
Change the values to match your own info
Ctrl + O
(save changes)Enter
(confirm that you want to overwrite the file)Ctrl + X
(exit the Nano text editor)cat .env
(print the file to the screen and make sure your changes are correct and saved)clear
(clear the terminal in case some shady fools walk past you and want to take all your base)
Do not use any kind of quotes/spaces/parenthesis around the values after the equal (=) sign. Your final .env
should look something like this
TWILIO_ACCOUNT_SID=IE3c56b36c9832678w32df32f1x99c1arb
TWILIO_AUTH_TOKEN=0re339862f7ef3aq38o2c8ch6km110aa
MONGO_DB_URI=mongodb+srv://shSMS-admin:dont_hack_me_bro@shsms-cluster.lq31i.mongodb.net/shSMS?retryWrites=true&w=majority
DEV_SERVER=https://shsms-heroku-server-01.herokuapp.com
REQ_TOKEN=THIS_IS_YOUR_SECRET_KEY_IT_CAN_BE_ANYTHING
TWILIO_ACCOUNT_SID
- Your Twilio SID (found on the main page of your Twilio console).
TWILIO_AUTH_TOKEN
- This is directly below the SID, but it's hidden. Just click the 'copy' button and paste it in.
MONGO_DB_URI
- That MongoDB thing we copied earlier. Make sure to replace the password and database name.
DEV_SERVER
- The URL of your Heroku instance.
REQ_TOKEN
- Any "password" unique to you. This is used as validation in all requests to your server and will be used in several places and you can change it at any time.
That's all for setting up our backend/server!! Heck yeah. All that's left is cloning that frontend client, adding some .env
variables to that thing and we're off to the races, at least for a local instance on our computer. Building that APK might be a different story, but we'll get through it together!
Last updated