Need Help with Github Tutorial

Hi there,

I have been trying to create a tutorial for github for FCC. But I need a lot of help for the purpose.
I am done with the skeleton of the page, but once the code is ready(Node+Passport+Express+Mlab + FrontEnd), how should I deploy it for campers to review and provide feedback? I mean, I could have gone with glitch but it cannot render something like :

<% if (user) { %>
Log out
<% } else { %>
Login
<% } %>

Glitch gives multiple errors while trying to render this.Can anyone please help me out if thereā€™s any way I could proceed with deploying the code?

I havenā€™t used Glitch but that stack is easy to stand up on Heroku. Curious why you would need a db and auth if itā€™s just a tutorial, though.

1 Like

Glitch is not that different from heroku in uploading your codebase. A couple differences are that on glitch you donā€™t use a CLI on your local machine like you do with heroku, instead you just import the code using glitchā€™s web interface directly from your linked github account, additionally your private api keys should be in .env file that is in the projectā€™s main directory on glitch, whereas on heroku, i set the keys in the web dashboard using app>settings>Config Variables (you can also set it with the CLI)

@AdityaOli post your github repo here, and also post the errors glitch is giving you

1 Like

@r1chard5mith What I am actually trying to do is to have two repos on userā€™s github account, say ā€œlocalā€ and ā€œremoteā€. Whatever is asked of the user to implement in the local repo, he/she also needs to merge it to the remote repo. That is why, to save sessions, repo information, progress etc, I thought using a db would be a great idea.

So, not just a tutorial, but in fact a learning platform that stores users and progress. Quite ambitious for your first live app. Good luck!

1 Like

Hi @Dereje1,

This is the link to the Github Repository. I am unable to import it into glitch as well, It says ā€œArg, something went wrong. Try again? :@ā€

I have not uploaded .env file data, but have uploaded the variables that need to be declared and initialized in the .env file in the similar format.

Ok, taking a look at it here in a few, just to verify , everything works as excepted locally on your machine right ? you are just having an issue when deploying it to glitch correct?

Yes. It works completely as expected on my local machine.

Ok I tried to link your project in github to glitch and you have several warnings re: bootstrap requiring you to also load jquery as it is a dependancy, but that is not what is causing you problems, the main error it is reporting is this,

/tmp/.__glitch__start.sh: line 1: null: command not found

the reason is because glitch needs a scripts start command in the package.json file similar to this format:

"scripts": {
    "start": "node xyz"
  }

where xyz is where your application should start, instead you are using nodemon in dev mode (understanble since you are developing locally, I use nodemon too)

so I changed this in your package.json file

"scripts": {
    "dev": "nodemon server.js"
  }

to this

"scripts": {
    "start": "node server.js"
  }

And it seems to take it BUT, now i get a different error

if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }

The reason is obvious, I donā€™t have your secret client id , so what I recommend is to do the above change yourself then throw in the client id in your .env file and see if it works.

FYI, under your profile in glitch click on ā€˜Logsā€™ to see what the exact errors and warnings you are getting.

1 Like

So now I have the application up and running. Thanks to @Dereje1 and @r1chard5mith.

Mistakes:

  1. I had to remove nodemon as mentioned above.
  2. Another thing as that I was importing the wrong way. It should have been ā€˜user/repoā€™ but i was pasting the entire clone url there.

Target:

What I have been able to do till now is here: https://freecodecamp-github-tutorial.glitch.me/

  1. The left and right hand side are for the github repos ā€˜localā€™ and ā€˜remoteā€™ respectively Currently I am triyng to build a logic like if I have the directory structure like
hackerrank-sdk/hackerrank/HackerRankAPI.py
hackerrank-sdk/hackerrank/__init__.py
hackerrank-sdk/hackerrank/testing.py
hackerrank-sdk/setup.cfg

so now I am trying to create a folder structure for the same. So there should be a parent folder hackerrank-sdk and on clicking that, all the files and folders should appear in that folder.

  1. the console button in the footer opens the console where the commands taken as input will be tried.
  2. The login button has been implemented using three-legged auth strategy. and it works fine now.