Developing backend applications locally

Developing backend applications locally
0

#1

Hi, everyone
I was just finished with the API challenges, I finished them all locally without a problem.

But now when I wanted to start the Backend Applications I followed these steps that I don’t understand, and I don’t even know how to deploy to heroku from c9.

My question is: can I develop these applications locally and is it really necessary to create a github application? what do I need it for? and what do i need the .env file for?

Thanks.


#2

You can develop locally, but you will need your code hosted online if you want to complete the back end certifications. Github is a good way to host your code. Also, Heroku uses git to push changes to their server, so you need to use git anyways. There might be other ways to push to Heroku, but git is what I’ve seen used.
The dotenv file is something that’s used to keep passwords and account IDs hidden instead of putting this information in your repository.
You can use Heroku environmental variables to do something similar once your code is on Heroku, I don’t use a dotenv file, I just hide any passwords in files by adding that file in the .gitignore until I have deployed it to heroku and then replaced the password ID with a variable and added the environmental variable to my heroku deployment.


#3

I’ve been using git since the beginning, what I don’t understand is why I need a github application? is it only necessary for c9 and clementine?


#4

You don’t need a Github ‘application’, you just need a Github account and to push your changes there. Github will allow the person who reviews your back end certification to review your code.
If you have some other way to host your code, you don’t have to use Github. They can’t see what code you’ve written just looking at the Heroku application.
Check out this for example, this just shows his code, and his application is deployed on Heroku.


#5

Yes, I built mine locally, then deployed to heroku with the database on mlab. The code I uploaded to github (which fit well with heroku because you save it there with git). So the app on heroku and the code is available on github. You’re going to have to learn github eventually so you might as well start now.

Deploying to heroku took a bit of work. The heroku CLI wouldn’t run in gitbash (but once I logged in I could use gitbash) and it took me a bit to figure how to use the environment variables (if you set them up locally with the dotenv package and then set up the same variable names in heroku under your app’s settings/reveal-config-variables, things go pretty smoothly), and it took a few tries to get the mlab DB to work (usually just creating a user and applying that name and password to the correct string in my environment variables.)

It was frustrating as all get up for the first app - I made a lot of little mistakes and had to go through heroku logs and search google for those error messages to figure out what the problem was. But now I’m getting the hang of it. I deployed my book trader app on the first try last night.